Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Hackett
3,191 Pointsis kwargs not the key here?
I thought that my use of kwargs would let me take in as many args as needed... then I would unpack them into a list, sort the list and pop the first item (although maybe it should be the last- but I'm failing before that!)
# If you need help, look up datetime.datetime.fromtimestamp()
# Also, remember that you *will not* know how many timestamps
# are coming in.
def timestamp_oldest(**kwargs):
posix_list = []
for key, value in kwargs.iteritems():
posix_list.append(key,value)
posix_list.sort()
return posix_list[0]
1 Answer
Dan Johnson
40,533 PointsUsing two asterisks will pack values into a dictionary, so you'd be expecting named arguments. In this challenge you're being passed in an unknown number of positional arguments so use a single asterisk instead:
def timestamp_oldest(*args):
# ...