0

How to make a loop to this code that asks the user if they want to do it again?

n=int(input("enter no. of times::")) print ("eggs"*n)

16th Dec 2016, 6:29 PM
Timo
Timo - avatar
3 Antworten
+ 1
Playagain = "Y" while Playagain != "N": n=int(input("\n\nenter no. of times:")) print ("eggs"*n) Playagain = (input("\nWould you like to Continue? (Y|N)"))
16th Dec 2016, 6:43 PM
Frédéric Charette
Frédéric Charette - avatar
+ 1
while True: try: n = input() print "eggs" * n except EOFError: break I didn't write your whole code, you can do it
16th Dec 2016, 6:50 PM
Rishi Anand
Rishi Anand - avatar
+ 1
This could work. I'm not 100 % sure since I'm just started learning. While x=y: --your code - - Print("repeat? ") x=input (" y or n")
16th Dec 2016, 6:50 PM
Daniel
Daniel - avatar