MCPcopy Create free account
hub / github.com/geekcomputers/Python / get_user_choice

Function get_user_choice

BrowserHistory/rock_paper_scissors.py:10–17  ·  view source on GitHub ↗

Prompt the user to enter their choice.

()

Source from the content-addressed store, hash-verified

8
9
10def get_user_choice():
11 """Prompt the user to enter their choice."""
12 choice = input("Enter your choice (rock, paper, scissors): ").lower()
13 if choice in ["rock", "paper", "scissors"]:
14 return choice
15 else:
16 print("Invalid choice! Please enter rock, paper, or scissors.")
17 return get_user_choice()
18
19
20def get_computer_choice():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected