What exactly are tuples in Python?
Posted
by Sergio Tapia
on Stack Overflow
See other posts from Stack Overflow
or by Sergio Tapia
Published on 2010-03-21T20:07:57Z
Indexed on
2010/03/21
20:11 UTC
Read the original article
Hit count: 507
I'm following a couple of Pythone exercises and I'm stumped at this one.
# C. sort_last
# Given a list of non-empty tuples, return a list sorted in increasing
# order by the last element in each tuple.
# e.g. [(1, 7), (1, 3), (3, 4, 5), (2, 2)] yields
# [(2, 2), (1, 3), (3, 4, 5), (1, 7)]
# Hint: use a custom key= function to extract the last element form each tuple.
def sort_last(tuples):
# +++your code here+++
return
What is a Tuple? Do they mean a List of Lists?
© Stack Overflow or respective owner