I'm trying to create a simple hangman game in Python. I've come quite far for a beginner I guess :) The only thing I can't accomplish is checking wether the word is actually guessed. I need to check if all the letters are actually in a list I've created, yet I'm not sure how. I do realise there was a topic regarding this, this didn't help me tho.
import random with open('randomlist.txt') as bestand: woordenlijst = bestand.read().splitlines() print("Welcome to Hangman.") naam = input("What is your name? ") print("Hello", naam, ", the computer selecter a secret word.") woord = random.choice(woordenlijst) lengte_woord = len(woord) ingevoerde_letters =  galg =  i = 0 print("The length of the word is: \n") while i < lengte_woord: print("_", end=" ") i = i + 1 levens = 0 invoer = " " print(woord) while levens <= 10: letter = input("Letter: ") if letter in ingevoerde_letters: print("You already tried this letter.") elif letter in woord: print("This letter is in the word. We'll fill it in for you.") i = 0 while i < lengte_woord: if woord[i] == letter: print(letter, end=" ") ingevoerde_letters.append(letter) i = i + 1 elif woord[i] in ingevoerde_letters: print(woord[i], end=" ") i = i + 1 else: print("_", end=" ") i = i + 1 else: ingevoerde_letters.append(letter) print("This letter is not in the word", galg[levens]) levens = levens + 1 print(galg, "\nGame over!")