python/Tucker/999.py
2024-03-11 20:05:37 -04:00

33 lines
770 B
Python

import random
print("Hello welcome to test!")
Player1 = input("Enter player 1's name:")
print(f"Hello {Player1}")
Player2 = input("Now enter player 2's name:")
print(f"Hello {Player2}")
number = random.randint(1,100)
attempt = 0
while True:
attempt +=1
if attempt % 2 != 0:
print(f"{Player1}'s turn.")
else:
print(f"{Player2}'s turn")
guess = int(input("make a guess:"))
if guess < number:
print("Too low. Try again.")
elif guess > number:
print("Too high. Try again.")
else:
if attempt % 2 != 0:
winner = Player1
else:
winner = Player2
print(f"congralts {winner} the number was {number}. YOU WIN!!!!")
break