Advertisement
Guest User

zgadnijliczbę.py

a guest
Jul 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import random, os
  2.  
  3. os.system("clear")
  4. print("Pomyslalem liczbe od 1 do 100\n")
  5.  
  6. traf = False
  7. liczba = random.randint(1,101)
  8. liczProb = 1
  9. print(liczba)
  10. while traf == False:
  11.     proba1 = input("Zgadnij: ")
  12.     os.system("clear")
  13.     try: proba = int(proba1)
  14.     except:
  15.         print("To nie liczba!")
  16.         proba = None
  17.     if type(proba) == int:
  18.         if proba < liczba: print("Za mało, spróbuj jeszcze raz\n")
  19.         elif proba > liczba: print("Za dużo, spróbuj jeszcze raz\n")
  20.         elif proba == liczba:
  21.             print("Brawo! Wygrałeś w " + str(liczProb) + " probie!")
  22.             traf = True
  23.     liczProb += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement