In [7]:
import random
def simon_says():
commands = ["Simon says jump", "Simon says clap", "Simon says nod", "Simon says sit", "Simon says spin","clap","nod", "sit", "spin"]
simon_command = random.choice(commands)
player_response = input(f"Simon says: {simon_command}\nYour response:")
if "Simon says" in simon_command and "Simon says" not in player_response:
print("You missed the following Simon's command.")
elif "Simon says" not in simon_command and "Simon says" in player_response:
print("You have followed a command that you should have not.")
else:
print("Great job! You have followed Simon's command.")
def exit():
exitanswer = input("Do you want to go again? Y or N?")
if exitanswer == "Y" or exitanswer == "y":
simon_says()
elif exitanswer == "N"or exitanswer == "n":
print("Have an wonderful day!!!")
print("Thanks for playing!")
else:
print("Y, y or N, n please")
exit()
simon_says()
exit()
Simon says: sit Your response:sit Great job! You have followed Simon's command. Do you want to go again? Y or N?y Simon says: spin Your response:spin Great job! You have followed Simon's command.