Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #rozkres chyb
  2. chyba1 = ("""
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. ~~~~~~~""")
  11. chyba2 = ("""
  12. +
  13. |
  14. |
  15. |
  16. |
  17. |
  18. ~~~~~~~""")
  19. chyba3 = ("""
  20. +---.
  21. |
  22. |
  23. |
  24. |
  25. |
  26. ~~~~~~~""")
  27. chyba4 = ("""
  28. +---.
  29. | |
  30. |
  31. |
  32. |
  33. |
  34. ~~~~~~~""")
  35. chyba5 = ("""
  36. +---.
  37. | |
  38. | O
  39. |
  40. |
  41. |
  42. ~~~~~~~""")
  43. chyba6 = ("""
  44. +---.
  45. | |
  46. | O
  47. | |
  48. |
  49. |
  50. ~~~~~~~""")
  51. chyba7 = ("""
  52. +---.
  53. | |
  54. | O
  55. | --|
  56. |
  57. |
  58. ~~~~~~~""")
  59. chyba8 = ("""
  60. +---.
  61. | |
  62. | O
  63. | --|--
  64. |
  65. |
  66. ~~~~~~~""")
  67. chyba9 = ("""
  68. +---.
  69. | |
  70. | O
  71. | --|--
  72. | /
  73. |
  74. ~~~~~~~""")
  75. chyba10 = ("""
  76. +---.
  77. | |
  78. | O
  79. | --|--
  80. | / \
  81. |
  82. ~~~~~~~""")
  83.  
  84. #funkce tahu
  85. def tah(slovo, retezec, pismeno):
  86. pozice = slovo.index(pismeno)
  87. return retezec[:pozice] + pismeno + retezec[pozice + 1:]
  88.  
  89.  
  90. #funkce chyb
  91. def pocet_chyb(chyba):
  92. return chyba + 1
  93.  
  94. #funkce pro vyhodnoceni sibenice
  95. def vyhodnot(chyba):
  96. if chyba == 1:
  97. print(chyba1)
  98. elif chyba == 2:
  99. print(chyba2)
  100. elif chyba == 3:
  101. print(chyba3)
  102. elif chyba == 4:
  103. print(chyba4)
  104. elif chyba == 5:
  105. print(chyba5)
  106. elif chyba == 6:
  107. print(chyba6)
  108. elif chyba == 7:
  109. print(chyba7)
  110. elif chyba == 8:
  111. print(chyba8)
  112. elif chyba == 9:
  113. print(chyba9)
  114. elif chyba == 10:
  115. print(chyba10)
  116. print("Smůla, zkus to znovu")
  117.  
  118.  
  119. #cela hra
  120. def sibenice():
  121. slovo = "python"
  122. retezec = "------"
  123. chyba = 0
  124. while True:
  125. pismeno = input("Zadej pismeno: ")
  126. if pismeno in slovo:
  127. if "-" in retezec:
  128. hrac = tah(slovo, retezec, pismeno)
  129. print(hrac)
  130. retezec = hrac
  131. elif "-" not in retezec:
  132. print("Gratuluji. Vyhral jsi!")
  133. break
  134. elif pismeno not in slovo:
  135. chyby = pocet_chyb(chyba)
  136. chyba = chyby
  137. vyhodnot(chyba)
  138. if chyba == 10:
  139. break
  140.  
  141.  
  142. sibenice()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement