IN PYTHON
Add a while loop to this code so that it will replay the Game of Life. Be sure to ask the user if they want to play again and exit the loop if they say no.
print("Welcome to the Game of Life!")
print("A. Banker")
print("B. Carpenter")
print("C. Farmer")
user_input = input("What is your occupation? ")
if user_input == "A":
money = 100
elif user_input == "B":
money = 70
elif user_input == "C":
money = 50
print("Great! you will start the game with", money, "dollars.")
choice = "yes" while(choice.lower()=='yes'): print("Welcome to the Game of Life!") print("A. Banker") print("B. Carpenter") print("C. Farmer") user_input = input("What is your occupation? ") if user_input == "A": money = 100 elif user_input == "B": money = 70 elif user_input == "C": money = 50 print("Great! you will start the game with", money, "dollars.") choice = input("Want to play again? (yes/no) ")
Get Answers For Free
Most questions answered within 1 hours.