Page
Name and Color W3S1P2
Name and Color W3S1P2
# Solution to problem W3S1P2
game = True
cont = "y"
while game == True:
name = input("What is your name ? ")
color = input("What is your favorite color ? ")
print ("Hi " + name + "! Your favorite color is " + color + ".")
while cont == "y":
cont = input("Do you want to play again (y/n) ? ")
if cont == "n":
game = False
elif cont == "y":
game = True
break # What is the purpose of this break
else:
cont = "y" # What is the purpose of this else?
Last modified: Wednesday, 6 December 2017, 9:43 AM