Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import colors as c
  2. import random
  3. k = random.randint(500,500000)
  4. x = random.randint(1, k)
  5. t = True
  6. z = 0
  7. p=0
  8. #open('number.txt')
  9. while (t):
  10. y = eval(input("what number do you guess: "))
  11. z += 1
  12. if x > y:
  13. print(c.blue("too low"))
  14. if x < y:
  15. print(c.red("too high"))
  16. if x == y:
  17. print("you guessed it")
  18. print("it took you", z, "times to guess the number")
  19. f = input("play again?: ")
  20. if f == "yes" or f == "y":
  21. x = random.randint(1, k)
  22. else:
  23. t = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement