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

Function get_user_choice

rock_paper_scissors.py:9–16  ·  view source on GitHub ↗

Prompt the user to enter their choice.

()

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected