Advertisement
Alive527

RNG Guesser

Mar 22nd, 2023
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.52 KB | None | 0 0
  1. import random
  2.  
  3. ans1 = random.randint(100, 899)
  4. prob = random.randint(1, 25)
  5. close1 = (ans1 - 100)
  6. close2 = (ans1 + 100)
  7. close3 = (ans1 - 25)
  8. close4 = (ans1 + 25)
  9. troll1 = (ans1 - prob)
  10. troll2 = (ans1 + prob)
  11. hund = (ans1 // 100)
  12.  
  13. num1 = int(input("Guess the code: "))
  14. if num1 == ans1:
  15.     print("\nWow! Way to ruin the fun")
  16. else:
  17.     print("\nHint: It is a three digit code")
  18.     num2 = int(input("Guess again: "))
  19.  
  20. if num2 == ans1:
  21.     print("\nSecond try! Impressive.")
  22. elif num2 > close1 and num2 < close2:
  23.     print("\nSo close!")
  24.     num3 = int(input("Guess again! "))
  25. else:
  26.     print("\nNot even close.")
  27.     print("\nHint #2: " + str(hund) + "__")
  28.     num3 = int(input("Guess again! "))
  29.  
  30. if num3 == ans1:
  31.     print("\nFinally. Congrats.")
  32. elif num3 > close3 or num3 < close4:
  33.     print("\nYou are atleast 25 away from your number!")
  34.     print("You have one last try.")
  35.     print("The answer is " + str(troll2))
  36.     num4 = int(input("Last guess: "))
  37. else:
  38.     print("\nOkay. One last try. The answer is " + str(troll1) + ". One number is a lie.")
  39.     num4 = int(input("Last guess: "))
  40.    
  41. if num4 == ans1:
  42.     print("\nYou failed at guessing the wrong number.")
  43. elif (num3 > close3 or num3 < close4) and num4 != troll2:
  44.     print("\nShould have guessed " + str(troll2) + ".")
  45.     print("But it was actually " + str(ans1))
  46. elif num4 != troll1:
  47.     print("\nShould have guessed " + str(troll1) + ".")
  48.     print("But it was actually " + str(ans1))
  49. else:
  50.     print("\nShould have guessed " + str(ans1))
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement