Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Andy Hughes8,114 Points
Chaining functions - i’m lost
Maybe it’s new year fuzz but I have no clue where to go with this challenge and everything I have tried results in “Bummer, Try Again!” I can’t find anything in the community section either.
I get that I’m supposed to be using Map() and Filter() somewhere. So my thinking is that I should be creating a function in step 1, that effectively loops through “birthdays” and compares them to “today”. Then if the number of years is 13 or greater, it returns a new iterable with those results.
That’s my thinking, but I just can’t seem to write anything that gives me the right result, or even a result that yields anything other than “Bummer, Try Again”. Which I will reiterate, is an entirely pointless message. :(
So wise owls, I could use a steer in the right direction.
Happy New Year :)
import datetime birthdays = [ datetime.datetime(2012, 4, 29), datetime.datetime(2006, 8, 9), datetime.datetime(1978, 5, 16), datetime.datetime(1981, 8, 15), datetime.datetime(2001, 7, 4), datetime.datetime(1999, 12, 30) ] today = datetime.datetime.today() def is_over_13(datetime): return (map(today - birthdays = 13))
Mel RumseyTreehouse Staff
Hey Andy Hughes !
So what this question is asking you to do, is to create a function that takes in a datetime which you have done here (but we will need to change the word
dt so that it doesn't confuse the python interpreter):
Then we need to return "whether or not the difference between that datetime and today is 4745 days (13 years × 365 days, ignoring leap years) or more."
So what we are returning for this part challenge is
(today - dt) which will get the difference between the passed in datetime and today. Then we need to access the
.day in that datetime, and return whether it is
Hopefully that helps you move on to the next 2 sections. You will be using map and filter in the 3rd stage. Let us know if you are still stuck!