SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top