Three players each guess a positive integer greater than 0, and then share them simultaneously. The winner is chosen following this formula:
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
# debugging statements
print(f"player 1 chose {p1}")
print(f"player 2 chose {p2}")
print(f"player 3 chose {p3}")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error")
else:
print("All numbers are greater than 0")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error")
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie")
else:
print("Not a Tie")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error")
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie")
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
print("All numbers are even")
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
print("All numbers are odd")
else:
print("Numbers are both even and odd")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error")
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie")
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins")
elif p2 < p1 and p2 < p3:
print("Player 2 wins")
else:
print("Player 3 wins")
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
print("All numbers are odd")
else:
print("Numbers are both even and odd")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error")
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie")
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins")
elif p2 < p1 and p2 < p3:
print("Player 2 wins")
else:
print("Player 3 wins")
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins")
elif p2 < p1 and p2 < p3:
print("Player 2 wins")
else:
print("Player 3 wins")
else:
print("Numbers are both even and odd")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error")
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie")
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins")
elif p2 < p1 and p2 < p3:
print("Player 2 wins")
else:
print("Player 3 wins")
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins")
elif p2 < p1 and p2 < p3:
print("Player 2 wins")
else:
print("Player 3 wins")
else:
if p1 > p2 and p1 > p3:
print("Player 1 wins")
elif p2 > p1 and p2 > p3:
print("Player 2 wins")
else:
print("Player 3 wins")
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error") # -1, -1, -1
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie") # 1, 1, 1
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
# find smallest # 2, 4, 6
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
# find smallest # 1, 3, 5
else:
# find largest # 1, 2, 3
# find smallest
if p1 < p2 and p1 < p3:
print("Player 1 wins") # 2, 4, 6
elif p2 < p1 and p2 < p3:
print("Player 2 wins") # 4, 2, 6
else:
print("Player 3 wins") # 4, 6, 2
# find largest
if p1 > p2 and p1 > p3:
print("Player 1 wins") # 3, 1, 2
elif p2 > p1 and p2 > p3:
print("Player 2 wins") # 1, 3, 2
else:
print("Player 3 wins") # 1, 2, 3
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error") # -1, -1, -1
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie") # 1, 1, 1
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins") # 2, 4, 6
elif p2 < p1 and p2 < p3:
print("Player 2 wins") # 4, 2, 6
else:
print("Player 3 wins") # 4, 6, 2
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins") # 1, 3, 5
elif p2 < p1 and p2 < p3:
print("Player 2 wins")
else:
print("Player 3 wins")
else:
if p1 > p2 and p1 > p3:
print("Player 1 wins") # 3, 1, 2
elif p2 > p1 and p2 > p3:
print("Player 2 wins") # 1, 3, 2
else:
print("Player 3 wins") # 1, 2, 3
p1 = int(input("Enter a positive integer for player 1: "))
p2 = int(input("Enter a positive integer for player 2: "))
p3 = int(input("Enter a positive integer for player 3: "))
if p1 <= 0 or p2 <= 0 or p3 <= 0:
print("Error") # -1, -1, -1
elif p1 == p2 or p2 == p3 or p3 == p1:
print("Tie") # 1, 1, 1
elif p1 % 2 == 0 and p2 % 2 == 0 and p3 % 2 == 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins") # 2, 4, 6
elif p2 < p1 and p2 < p3:
print("Player 2 wins") # 4, 2, 6
else:
print("Player 3 wins") # 4, 6, 2
elif p1 % 2 != 0 and p2 % 2 != 0 and p3 % 2 != 0:
if p1 < p2 and p1 < p3:
print("Player 1 wins") # 1, 3, 5
elif p2 < p1 and p2 < p3:
print("Player 2 wins") # 3, 1, 5
else:
print("Player 3 wins") # 3, 5, 1
else:
if p1 > p2 and p1 > p3:
print("Player 1 wins") # 3, 1, 2
elif p2 > p1 and p2 > p3:
print("Player 2 wins") # 1, 3, 2
else:
print("Player 3 wins") # 1, 2, 3