This is another assignment on functions: Following Lab 8, fil in the missing fun
ID: 3601290 • Letter: T
Question
This is another assignment on functions: Following Lab 8, fil in the missing function definitions for this program: def main: #Prints "Welcome" to welcome0 the screen age-user!nput() #Ask the user for their age and return number entered #Using age, calculate(age) calculates year born displayResults(age,y) #Prints age and birth year main0 That is, write the functions welcome0, userlnput0, calculate0 and displayResults0. Submit a .py file containing all four functions you wrote, in addition to the main0 function above.Explanation / Answer
import datetime
def welcome():
print("Welcome to the screen ");
def userInput():
age = int(input("Enter your age :"))
return age
def calculate(age):
now = datetime.datetime.now()
return (now.year - age)
def displayResults(age,y):
print("Age is :",age)
print("Year born is :",y)
def main():
welcome()
age = userInput()
y = calculate(age)
displayResults(age,y)
main()
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.