We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd5939d commit bf11cfcCopy full SHA for bf11cfc
stone_paper_scissor/main.py
@@ -6,7 +6,16 @@
6
player_name = input('Please enter your name: ') # Takes Input from the user
7
8
print('Pick a hand: (0: Rock, 1: Paper, 2: Scissors)')
9
-player_hand = int(input('Please enter a number (0-2): '))
+
10
+while True:
11
+ try:
12
+ player_hand = int(input('Please enter a number (0-2): '))
13
+ if player_hand not in range(0, 3):
14
+ raise ValueError
15
+ else:
16
+ break
17
+ except ValueError as e:
18
+ print('Please input a correct number')
19
20
if utils.validate(player_hand):
21
# Assign a random number between 0 and 2 to computer_hand using randint
0 commit comments