-
Notifications
You must be signed in to change notification settings - Fork 4
/
Determine The Winner.py
50 lines (40 loc) · 1.03 KB
/
Determine The Winner.py
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
49
50
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 13 22:44:56 2020
@author: Ravi
"""
def winner(arr,jack):
p1 = 'Player 1 wins'
p2 = 'Player 2 wins'
d = 'Draw'
if arr[0] == jack and arr[2]!= jack:
return p1
if arr[0]!= jack and arr[2]== jack:
return p2
if arr[0]!=jack and arr[0]!=jack:
if arr[1] == arr[3]:
return d
if arr[0]!=jack and arr[0]!=jack:
if arr[1]>arr[3]:
return p1
else:
return p2
if arr[0] == jack and arr[2]==jack:
if arr[1]>arr[3]:
return p1
else:
return p2
if arr[0] == jack and arr[2]==jack:
if arr[1] == arr[3]:
return d
if arr[0] == arr[2]:
if arr[1]>arr[3]:
return p1
else:
return p2
jack = input()
n = int(input())
arr = []
for i in range(n):
arr = list(map(str , input().split(" ")))
print(winner(arr,jack))