Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. #!/bin/python3
  2. # http://jumpto.cc/rps-go
  3.  
  4. hangmans = [
  5. """
  6. ____
  7. |   |
  8. |
  9. |
  10. |
  11. |
  12. ------
  13. """,
  14. """
  15. ____
  16. |   |
  17. |   O
  18. |
  19. |
  20. |
  21. ------
  22. """,
  23. """
  24. ____
  25. |   |
  26. |   O
  27. |   |
  28. |  
  29. |
  30. ------
  31. """,
  32. """
  33. ____
  34. |   |
  35. |   O
  36. |  /|
  37. |  
  38. |
  39. ------
  40. """,
  41. """
  42. ____
  43. |   |
  44. |   O
  45. |  /|\\
  46. |  
  47. |
  48. ------
  49. """,
  50. """
  51. ____
  52. |   |
  53. |   O
  54. |  /|\\
  55. |  /
  56. |
  57. ------
  58. """,
  59. """
  60. ____
  61. |   |
  62. |   O
  63. |  /|\\
  64. |  / \\
  65. |
  66. ------
  67. """,
  68. ]
  69.  
  70. incorrectGuesses = [] # empty list, we will put things inside it later
  71. correctGuesses = []
  72.  
  73. guesses = len(hangmans)
  74.  
  75. print("Enter your word:")
  76. word = input().upper()
  77.  
  78. print("\n" * 30) # Clear the screen by printing 30 new lines
  79.  
  80. print(hangmans[-guesses]) # Print the empty hangman
  81.  
  82. while guesses > 1:
  83.  
  84.   print()
  85.   for letter in word: # Loop through the word
  86.     if letter in correctGuesses:
  87.       print(letter + " ", end="")
  88.     else:
  89.       print("_ ", end="")
  90.   print()
  91.  
  92.   print("Guess a letter:")
  93.   guess = input().upper()
  94.  
  95.   if guess in word:
  96.     print("Correct!")
  97.    
  98.     if guess not in correctGuesses:
  99.       correctGuesses.append(guess)
  100.   else:
  101.     print("Incorrect!")
  102.     guesses -= 1
  103.    
  104.     incorrectGuesses.append(guess)
  105.    
  106.   print(hangmans[-guesses])
  107.   print("Guessed:")
  108.   print(incorrectGuesses)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement