Hi guys I'm a beginner python developer. I want to randomly generate a number between 0 and 20. The user needs to guess what the number is. If the user guesses wrong, tell them their guess is either too high or too low. I made almost everything, but I didn't made this section. >if the user guesses wrong, tell them their guess is either too high or too low.
This is the code
import random
guess_count = 0
guess_limit = 3
random.randint = [
(1,2,3,4,5),
(6,7,8,9,10),
(11,12,13,14,15),
(16,17,18,19,20)
]
while guess_count < guess_limit:
guess = int(input("Guess: "))
guess_count += 1
if guess < random.randint:
print("Low guess")
elif guess > random.randint:
print("High guess")
elif guess == random.randint:
print("You won!")
break
else:
print("You failed!")
Can you help me? :)
Aucun commentaire:
Enregistrer un commentaire