+ 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 :(
3 Antworten
+ 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.
+ 1
Yes, that did help, thank you.