+ 1

Having some trouble understanding python return functions properly. The order is throwing me off.

Ok so for an example in trying to get the answer back about my daughter's age: Def jazzys_age(birth_year, current_year): return current_year - birth_year jazzys_age(2015, 2019) print("Jasmine is" + str(jasmines_age) + "years old") I realize I'm doing something wrong but I'm not sure what I am missing. Please help me :(

17th Jan 2019, 5:43 PM
Lottie Patterson
Lottie Patterson - avatar
3 Réponses
+ 1
You’re returning a value, you have to store it in a var eg. age = jazzys_age(2015, 2019) print(age) or print(jazzys_age(2015, 2019)) or call the function in print, that should do the trick, when returning something always make sure to assign it, hope this helps.
17th Jan 2019, 6:08 PM
Joery De Loose
Joery De Loose - avatar
+ 1
Yes, that did help, thank you.
18th Jan 2019, 12:10 AM
Lottie Patterson
Lottie Patterson - avatar