In: Computer Science
What am i doing wrong. I want for the program to run through then when it gets to "do you want to play again?enter yes or no" if they choose yes I want it to run again if they choose no then end.
def play():
print("Welcome to the Game of Life!")
print("A. Banker")
print("B. Carpenter")
print("C. Farmer")
user_input = input("What is your occupation? ").upper()
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.")
while True:
x = input(" \n Do You want to play again? Enter Yes or
No.").upper()
if x == 'Yes':
play()
elif x == 'No':
print("Thank you for playing.")
break;
def play():
print("Welcome to the Game of Life!")
print("A. Banker")
print("B. Carpenter")
print("C. Farmer")
user_input = input("What is your occupation? ").upper()
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.")
# Just make a call to play to run this code
play()
x = input(" \nDo You want to play again? Enter Yes or No.").upper()
while x == "YES":
if x == 'YES':
play()
elif x == 'NO':
print("Thank you for playing.")
x = input(" \nDo You want to play again? Enter Yes or No.").upper()

