Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- jrk = int(input("How many chances do you want to guess the number??"))
- arv = randint(1, 10)
- guess = int(input("You have " + str(jrk) + " guesses! Think of a number betwen 1-10: "))
- while jrk != 0:
- if arv > guess:
- jrk -= 1
- guess = int(input("You have " + str(jrk) + " chances left. The searchable number is bigger. Try again:"))
- elif arv < guess:
- jrk -= 1
- guess = int(input("You have " + str(jrk) + " chances left. The searhable number is smaller. Try again:"))
- if guess == arv:
- print("You won.")
- break
- if jrk == 0:
- print("You lost. The number was " + str(arv))
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement