Advertisement
Ismatullo

Untitled

Jun 25th, 2022
935
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None
  1. import random
  2. from colorama import Back, Fore
  3. def oyin():
  4.     rannum = random.randint(1, 5)
  5.     otvet = input(Back.YELLOW + Fore.BLACK + "1 dan 5 gacha bo'lgan yashiringan sonni toping: ")
  6.  
  7.     if rannum == int(otvet):
  8.         print(Back.LIGHTGREEN_EX + "Yashiringan sonni topdingiz!")
  9.     elif rannum > int(otvet):
  10.         print(Back.RED + "Topa olmadingiz")
  11.     elif rannum < int(otvet):
  12.         print(Back.RED + "Topa olmadingiz")
  13.     else:
  14.         oyin()
  15.  
  16.     print("Yashiringan son", rannum, "edi")
  17.  
  18.     otvet2 = input(Back.CYAN + "Yana bir bor urinib ko'rasizmi? \n" + Back.GREEN + "Ha - [ENTER]\n" + Back.RED + "Yoq - (exit): ")
  19.  
  20.     if otvet2 == 'exit':
  21.         exit()
  22.     else:
  23.         oyin()
  24.  
  25. oyin()
Advertisement
RAW Paste Data Copied
Advertisement