I am just exploring the vast language of python. I'm heavily relying on the inbuilt error-decetion and googling to debug my programs. I had no luck this time around. Thank you for your time!
I am getting
"invalid syntax at line 5"
Here is my python-code of a simple HANGMAN-game:
import random
def __secretword__():
secret_word = word_list[random.randomint(len(word_list))
return secret_word #THIS IS LINE 5
def __ask__():
ans = input("Would you like to play more? (yes/no): ")
if ans == "yes"
__secretword__()
else:
print(":(")
__secretword__()
word_list = ["nei", "brun", "ja", "smile", "glad", "gal"]
secret_word = secret_word
sw_list = list(secret_word)
guess_lines = ["_"] * len(secret_word)
mistakes = []
lives = 2 * len(secret_word)
print(guess_lines)
user_guess = input("Guess a letter: ")
while(lives != 0)
if user_guess in sw_list:
i = sw_list.index(user_guess)
del guess_lines[i]
guess_lines.insert(i, user_guess)
print(guess_lines)
print("Lives: ", lives)
print("Mistakes: ", mistakes)
if "_" not in guess_lines:
break
else:
mistakes.append(user_guess)
print(guess_lines)
lives = lives - 1
print("Lives: ", lives)
print(mistakes)
__ask__()
word_listbefore the function__secretword__word_list[random.randomint(len(word_list)). Incidentally, if the error is on line 5, do not post the remaining irrelevant lines.