-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprac8.py
More file actions
48 lines (39 loc) · 1.18 KB
/
prac8.py
File metadata and controls
48 lines (39 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 19:42:21 2019
@author: rounak
"""
def choice():
input_int = int(input("1. Rock\n2. Paper\n3. Scissors\nEnter your choice: "))
return input_int
while True:
print("\nTeam 1", end = "")
team1 = choice()
print("Team 2", end = "")
team2 = choice()
if team1 == 1:
if team2 == 1:
print("Same choice!!! Play again.\n")
elif team2 == 2:
print("Player 2 won!!\n")
else:
print("Player 1 won!!\n")
elif team1 == 2:
if team2 == 1:
print("Player 1 won!!\n")
elif team2 == 2:
print("Same choice!!! Play again.\n")
else:
print("Player 2 won!!\n")
elif team1 == 3:
if team2 == 1:
print("Player 2 won!!\n")
elif team2 == 2:
print("Player 1 won!!\n")
else:
print("Same choice!!! Play again.\n")
else:
print("Wrong choice entered!!\n")
input_str = input("Do you want to play again (Y/N): ")
if input_str == "N" or input_str == "n":
break