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 trialzfusdjitsz
2,797 PointsI tested this in a shell and it appears to be working as intended. Can anyone offer insight?
def timestamp_oldest(timestamp_args):
max_time = datetime.datetime.fromtimestamp(timestamp_args[0])
for current_time in timestamp_args:
if datetime.datetime.fromtimestamp(current_time) < max_time:
max_time = datetime.datetime.fromtimestamp(current_time)
return max_time
I guess I should mention the error I'm getting. I'm paraphrasing but it says that timestamp_oldest takes 1 argument but 8 given.
Anthony Liu
11,374 PointsIn the prompt it states "any number of POSIX timestamp arguments" because the number of arguments is unknown we add "*" in front of the argument to denote any possible number of arguments.
1 Answer
Kenneth Love
Treehouse Guest TeacherYeah, the "any number of" is the clue that you need to accept an unknown number of items. I'll try to make that a bit more clear. Glad you figured out the answer!
zfusdjitsz
2,797 PointsGot ya! Thanks to both Anthony Liu and Kenneth Love. I must have dozed while that was being covered. I'll remember that going forward. Thanks again guys
zfusdjitsz
2,797 Pointszfusdjitsz
2,797 PointsI was going to delete this post but I figure just in case someone else has any trouble it'll be here. I need to take some additional time to understand the packing and unpacking of tuples. I added an '*' so that the function definition essentially starts with
```def timestamp_oldest(*timestamp_args)
I totally guessed that though (shot in the dark) so I need to understand why that worked.