fork(1) download
  1. import random
  2. x = random.randrange(10) + 1
  3. y = ''
  4. count = 0
  5. while y != x:
  6. y = int(raw_input('I\'ve picked a number. Make a guess!\n'))
  7. count += 1
  8. if y > x:
  9. print 'Wrong guess! Try lower number!'
  10. elif y < x:
  11. print 'Wrong guess! Try higher number!'
  12.  
  13. print 'Congratulation! You guess right, though it took you', count, ' tries'
  14. raw_input('\n\nP')
Runtime error #stdin #stdout #stderr 0.01s 10040KB
stdin
Standard input is empty
stdout
I've picked a number. Make a guess!
stderr
Traceback (most recent call last):
  File "prog.py", line 6, in <module>
EOFError: EOF when reading a line