Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- print('Odgadnij liczbę')
- print()
- sekretnaLiczba = random.randint(1, 100) # ukryta liczba
- print('Pomyślałem liczbę pomiędzy 1 and 100.')
- for i in range(10): # daj zgadującemu 10 możliwości.
- print('Pozostało', (10 - i), 'możliwości. Odgadnij teraz.')
- guess = int(input('> ')) # Podaj liczbę.
- if guess == sekretnaLiczba:
- break # Break out of the for loop if the guess is correct.
- if guess < sekretnaLiczba:
- print('Liczba jest za mała.')
- if guess > sekretnaLiczba:
- print('Liczba jest za duża.')
- if guess == sekretnaLiczba:
- print('Świetnie! Udało się!')
- else:
- print('Koniec gry. Moja liczba to', sekretnaLiczba)
Advertisement
Add Comment
Please, Sign In to add comment