Files
2026-10-19 20:29:13 +02:00

20 lines
498 B
Python

import random
def gamble():
counter = 0
print("in this game you have to guess a random number between 1 and 100")
target = int(random.randint(1,100))
while True:
guess = int(input("Take a guess! : "))
if target == guess:
print("You won!")
print("guesses taken: ",counter)
break
if target > guess:
print("too low")
if target < guess:
print("too high")
counter = counter+1
gamble()