Labels

Tuesday, January 18, 2022

Write a function 'problem1_5(age)'. This function should use if-elif-else statement to print out "Have a glass of milk." for anyone under 7; "Have a coke." for anyone under 21, and "Have a martini." for anyone 21 or older.


 def problem1_5(age): 
if age<7:
        print("Have a glass of milk.")
    elif age<21:
        print("Have a coke.")
    else:
        print("Have a martini.")
problem1_5(21) #enter any age at 21

No comments:

Post a Comment

How to get free course on Coursera with cirtificate ? , coursera Financial aid questions & answers :

Coursera Financial aid questions & answers   Q1) Why are you applying for Financial Aid? ans:-    I am in my second year of B.Tech in ...