Jul-10-2018, 05:28 AM
yearAt100
is local to the function yearThatYouTurn100
. Once the function is over (after "return"), the variable ceases to exist for the rest of the program.So what you should do is store the returned result in a variable, which you can then print:
def main(): result = yearThatYouTurn100() print(result)
result
will hold the value returned by the function.This principle works generally for functions, and for any data types you might want to return.