fork download
  1. # -*- coding: utf-8 -*-
  2. import random
  3. s1 = "konnichiwa"
  4. s2 = 'fuel'
  5. s3= 'desperado'
  6. tuple1 = (s1, s2, s3)
  7. sourceword = random.choice(tuple1)
  8. sourceword1 = sourceword
  9. guessword = ''
  10. guesscount = 0
  11. while True:
  12. if sourceword != '':
  13. letternumber = random.randrange(len(sourceword))
  14. guessword += sourceword[letternumber]
  15. sourceword = sourceword[letternumber + 1:] + sourceword[:letternumber]
  16.  
  17. if sourceword == '':
  18. print guessword
  19. break
  20.  
  21. playerword = raw_input('Enter your guess\n')
  22. playerword = playerword.lower()
  23. while True:
  24. if playerword != sourceword1 or playerword == '':
  25. playerword = raw_input('Wrong. Try again\n')
  26. guesscount += 1
  27. if guesscount > 0:
  28. print 'Hint, it has this part in it:', sourceword1[random.randrange(0, len(sourceword1)/2):random.randrange(len(sourceword1)/2, len(sourceword1))]
  29. if playerword == sourceword1 and guesscount <= 3:
  30. print 'gratz. you stayed within guess margin'
  31. break
  32. elif playerword == sourceword1 and guesscount > 3:
  33. print 'gratz. tho it took you some time'
  34. break
  35. raw_input('\n\nPr')
Runtime error #stdin #stdout #stderr 0.02s 10088KB
stdin
Standard input is empty
stdout
eeodprdas
Enter your guess
stderr
Traceback (most recent call last):
  File "prog.py", line 21, in <module>
EOFError: EOF when reading a line