Advertisement
Guest User

valeranew@ukr,net

a guest
Feb 17th, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import random
  4.  
  5. number=random.randint(1, 10)
  6.  
  7. hello = (str(raw_input("Жмакай Y, если хочешь сыграть в угадайку, ну или N, чтобы пропустить блок ")))
  8. running=True
  9.  
  10. if hello == "Y":
  11.     while running:
  12.         try:
  13.             guess = int(raw_input('Введите целое число : '))
  14.         except KeyboardInterrupt:
  15.             break
  16.         except:
  17.             print('Это не число. }:(')
  18.             continue
  19.         if guess == number:
  20.              print('Поздравляю, вы угадали.')
  21.              running = False # это останавливает цикл while
  22.         elif guess < number:
  23.              print('Нет, загаданное число немного больше этого')
  24.         else:
  25.              print('Нет, загаданное число немного меньше этого.')
  26. else:
  27.     print('Завершение.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement