I am trying to make a hangman game and I am not fully sure on how to add a specific letter to a variable. For example, adding a letter that someone chose through the pythons' input prompt to a variable. Here is the code I am working on:
import random
import time
word_list = ['that', 'poop', 'situation', 'coding', 'python', 'turtle', 'random', 'passive', 'neutral', 'factor', 'time']
word_chosen = random.choice(word_list)
your_name = input("What is your name?")
time.sleep(1)
print("Hello " + your_name + ", lets play some hangman!, The amount of letters in the word is below!")
guesses = 7
time.sleep(1)
hidden_word = ""
for i in word_chosen:
hidden_word += "-"
while True:
n = 1
time.sleep(1)
print("Your word is: " + hidden_word)
print("___________")
print("|")
print("|")
print("|")
print("|")
print("|")
print("|")
print("|")
characters = (word_chosen)
time.sleep(1)
letters_correct = ""
characters_guessed = input("Type in the letters you think are in this word!")
for i in characters:
hidden_word == characters_guessed
if characters_guessed == characters:
print(hidden_word + characters)
else:
int(guesses) - int(n)
print("Nope, sorry.")