the game Hangman
Verfasst: Mittwoch 19. Dezember 2018, 10:35
Hallo Community,
ich habe folgendes Problem ich möchte ein kleines Programm schreiben wie der Titel schon sagt nämlich Hangman.
Jetzt habe ich folgenden Code mit folgenden Fehler:
Fehlermeldung Programm startet nicht friert ein:
RESTART: C:/Users/Joachim Gradischnik/Desktop/Programing/source_code/python/Mittwoch_19122018/Hagman_19122018.py
Bitte um Hilfe Danke.
lg
Joachim
ich habe folgendes Problem ich möchte ein kleines Programm schreiben wie der Titel schon sagt nämlich Hangman.
Jetzt habe ich folgenden Code mit folgenden Fehler:
Code: Alles auswählen
"""Hangman
Standard game of Hangman. A word is chosen at random from a list and the
user must guess the word letter by letter before running aout of attempts."""
import random
def main():
welcome = ['Welcome to Hangman! A word will chosen at random and',
'you must try to guess the word correctly letter by letter',
'before you run out of attemps. Good lock!'
]
for line in welcome:
print(line, sep='\n')
# setting up the play_again loop
play_again = True
while play_again:
# setup the game loop
words = ["hangman","maus","phillip","malena","papa","mama","sybille"
]
chosen_word = random.choise(words).lower()
player_guess = None #will hold the players guess
guessed_letters = [] #a list of letters guessed so far
word_guessed = []
for letter in chosen_word:
word_guessed.append("-")#create an ungessed, blank version of the word
joined_word = None # joins the words in the list word_guessed
HANGMAN=(
"""
-----
| |
|
|
|
|
|
|
|
------
"""
,
""""
-----
| |
| 0
|
|
|
|
|
|
------
RESTART: C:/Users/Joachim Gradischnik/Desktop/Programing/source_code/python/Mittwoch_19122018/Hagman_19122018.py
Bitte um Hilfe Danke.
lg
Joachim