+ 1

Exam question

How would I write A algorithm that asks for users age (years) then prints the message ‘happy birthday’ that many times.

22nd Apr 2018, 5:50 PM
Janet
Janet - avatar
4 Réponses
0
age=int(input()) while age>=0: print("Happy Birthday") age-=1
24th Apr 2018, 1:01 AM
Christopher
Christopher - avatar
+ 1
#Promting user to enter their age age = int(input("Enter your age: ")) #For age number of times print for x in range(age): print("Happy Birthday!")
22nd Apr 2018, 6:29 PM
Danigamy
Danigamy - avatar
+ 1
Thank you so much
22nd Apr 2018, 6:30 PM
Janet
Janet - avatar
0
Welcome!
22nd Apr 2018, 6:32 PM
Danigamy
Danigamy - avatar