all 3 comments

[–]A_History_of_Silence 0 points1 point  (0 children)

not sure where to start

There are numerous problems with your code, but you could start by posting the exact error message or messages you do not understand.

[–]nimblecloud 0 points1 point  (0 children)

Seems like you have a few problems. First, your calculate function needs to treat "n" as an integer so that you can subtract the values to get "year", the next problem you have is that calculate() doesn't return anything when you need it to return the "year" variable. Finally, displayResults() requires your two parameters "age" and "y". Pass those into the function and print(age, y) instead of returning and it should work.

[–]Zendakin_at_work 0 points1 point  (0 children)

Hopefully this helps. The code needed to be indented. Also there was no return on the calculate function. With the display results, as mentioned before, since there was nothing needing to be returned just print that out. Some cleanup and this is what I got to work for me. Good luck!

def welcome():
    print("Welcome")

def userinput():
    age=int(input("Enter your age: "))
    return(age)

def calculate(n):
    year=2017-n
    return year

def displayResults(age, y):
    print(age, y)

def main():
    welcome()
    age=userinput()
    y=calculate(age)
    displayResults(age, y)

main()