fork download
  1. import random
  2. x = random.randrange(10) + 1
  3. y = ''
  4. guessnumber = 0
  5. while True:
  6. if y != x and guessnumber <= 2:
  7. y = int(raw_input('I\'ve picked a number. Make a guess!\n'))
  8. if y > x:
  9. print 'Wrong guess! Try lower number!'
  10. elif y < x:
  11. print 'Wrong guess! Try higher number!'
  12. elif y == x:
  13. print 'Gratz!'
  14. break
  15. guessnumber += 1
  16. if guessnumber == 2:
  17. y = int(raw_input('I\'ve picked a number. Make a guess!\n'))
  18. if y == x:
  19. print 'Gratz!'
  20. break
  21. else:
  22. print 'Fail. Out of guesses.'
  23. break
  24.  
  25. raw_input('\n\nP')
Runtime error #stdin #stdout #stderr 0.02s 10088KB
stdin
Standard input is empty
stdout
I've picked a number. Make a guess!
stderr
Traceback (most recent call last):
  File "prog.py", line 7, in <module>
EOFError: EOF when reading a line