Advertisement
Guest User

edit

a guest
Dec 7th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. #separate cell
  2. def whattoguess(word):
  3. for char in word:
  4. print(char, end = '')
  5. print()
  6.  
  7. from IPython.display import clear_output
  8. import random
  9.  
  10. consonants = ['B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z']
  11. vowels = ['A','E','I','O','U']
  12. prize = 0
  13. values = ["BANKRUPT", 500, 550, 600, 650, 700, 750, 800, 850, 2500]
  14.  
  15. word = input("Please enter a string for the player to guess: ")
  16. clear_output()
  17.  
  18. phrase = []
  19. for char in word:
  20. if char.isalpha():
  21. phrase.append('-')
  22. else:
  23. phrase.append(char)
  24.  
  25. while True:
  26. print("\nGuess the phrase: ")
  27. whattoguess(phrase)
  28. print(" 1) Spin the wheel")
  29. print(" 2) Buy a vowel")
  30. print(" 3) Solve the puzzle")
  31. print("\nUnused consonants: ", *consonants, sep="")
  32. print("\nUnused vowels: ",*vowels, sep="")
  33. print("\nPrize pool:", prize)
  34.  
  35. a = input("\nEnter action: ")
  36.  
  37. if a == "1":
  38. prizewon = random.choice(values)
  39. if prizewon == "BANKRUPT":
  40. print("\nThe wheel lands at:", prizewon)
  41. print("\nThough luck! Prize pool resets to 0.")
  42. prize = 0
  43. else:
  44. print("\nThe wheel lands at:", prizewon)
  45. c = input("\nEnter consonant: ")
  46. for n, i in enumerate(consonants):
  47. if i == c:
  48. consonants[n] = ""
  49. if c in word:
  50. print("\n",c, "is found!")
  51. for i, n in enumerate(word):
  52. if n != '-' and c == n:
  53. phrase[i] = n
  54. prize = prize + (prizewon * phrase.count(c))
  55.  
  56. if c not in word:
  57. prize = prize
  58. print("\nSorry,", c, "is not found.")
  59.  
  60. if a == "2":
  61. if prize < 250:
  62. print("\nYou don't have enough money to buy a vowel.")
  63. else:
  64. prize = prize - 250
  65. v = input("\nEnter vowel: ")
  66. for n, i in enumerate(vowels):
  67. if i == v:
  68. vowels[n] = ""
  69. if v in word:
  70. print("\nAll", v,"\b's shown.")
  71. for i, n in enumerate(word):
  72. if n != '-' and v == n:
  73. phrase[i] = n
  74. if v not in word:
  75. print("\nSorry,", v, "is not found.")
  76.  
  77. if a == "3":
  78. x = input("\nEnter phrase / sentence: ")
  79. if x == word:
  80. print("\nCongratulations! You win a total of", prize, "!")
  81. else:
  82. print("\nSorry. Incorrect phrase / sentence.")
  83. again = input("\nPlay again(Y/N)? ")
  84. if again == "Y":
  85. consonants = ['B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z']
  86. vowels = ['A','E','I','O','U']
  87. prize = 0
  88. values = ["BANKRUPT", 500, 550, 600, 650, 700, 750, 800, 850, 2500]
  89.  
  90. word = input("Please enter a string for the player to guess: ")
  91. clear_output()
  92.  
  93. phrase = []
  94. for char in word:
  95. if char.isalpha():
  96. phrase.append('-')
  97. else:
  98. phrase.append(char)
  99. continue
  100. elif again == 'N':
  101. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement