Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- num = random.randrange(1, 101)
- print(num)
- guess =""
- tries= 0
- tries_limit = 6
- try :
- while num != guess and tries != tries_limit:
- guess =int(input("enter a digit: "))
- tries += 1
- if guess > num:
- print("too high")
- elif guess < num:
- print("too low")
- elif num == guess and tries == 1:
- print("dang, YOU ARE FUCKING SMART")
- elif num == guess and tries == 2:
- print("whAt a Genius")
- elif num == guess and tries == 3:
- print("nice try!!")
- elif num == guess and tries== 4:
- print("nice try!! ")
- elif num == guess and tries == 5:
- print("dumb ass, THAT WAS CLOSE")
- elif num == guess and tries == 6:
- print("block head")
- if tries > tries_limit :
- print("YOU LOSE!!! MOTHERFUCKER")
- except ValueError:
- print("that was a value error bro!!")
- #whenever the Value error is run it stops the code. But I want it to continue, I have tried the
- #continue loop but it gives feed back that "continue is outside of loop.
- #the help is how do I run it without it stopping the program when a user enters a non-int value
- print("number of tries: ", tries)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement