1
+ #!/bin/python3
2
+
3
+ from random import randint
4
+
5
+ player = input ('rock (r), paper (p) or scissors (s)?' )
6
+
7
+ if (player == 'r' ):
8
+ print ('O' , end = ' ' )
9
+
10
+ elif (player == 'p' ):
11
+ print ('___' , end = ' ' )
12
+
13
+ elif (player == 's' ):
14
+ print ('>8' , end = ' ' )
15
+
16
+ else :
17
+ print ('??' )
18
+
19
+ print ('vs' , end = ' ' )
20
+
21
+ chosen = randint (1 ,3 )
22
+
23
+ if (chosen == 1 ):
24
+ computer = 'r'
25
+ print ('O' )
26
+
27
+ elif (chosen == 2 ):
28
+ computer = 'p'
29
+ print ('___' )
30
+
31
+ else :
32
+ computer = 's'
33
+ print ('>8' )
34
+
35
+ if (player == computer ):
36
+ print ('DRAW!' )
37
+
38
+ elif (player == 'r' and computer == 's' ):
39
+ print ('Player wins!' )
40
+
41
+ elif (player == 'r' and computer == 'p' ):
42
+ print ('Computer wins!' )
43
+
44
+ elif (player == 'p' and computer == 'r' ):
45
+ print ('Player wins!' )
46
+
47
+ elif (player == 'p' and computer == 's' ):
48
+ print ('Computer wins!' )
49
+
50
+ elif (player == 's' and computer == 'p' ):
51
+ print ('Player wins!' )
52
+
53
+ elif (player == "s" and computer == 'r' ):
54
+ print ('Computer wins!' )
55
+
56
+ else :
57
+ print ('Huh?' )
58
+
59
+
0 commit comments