So I've been learning python and I'm trying to make my first game to just try the language on my own and get to grips with it. While making this word guessing game, I ran in to an issue with input which I am finding it difficult to overcome.
import sys
import os
import random
import time
word_list = ["salt","excess","product","rib","slot","battle"]
#random word from list
random_word = random.choice(word_list)
#defining word_len and making it a string so it can be used in print()
word_len = len(random_word)
word_len = str(word_len)
print("Welcome to the guessing game")
print("I will give you the length of a random word and you need to guess
what it is!")
print("The word is " + word_len + " characters long.")
print("The choices are " + "salt " + "excess " + "product" + " rib" + "
slot" + " and battle" )
print("Good luck!")
#reads the input and defines it
word_guess = sys.stdin.readline()
if word_guess is random_word :
print("Congratulations! You guessed correctly!")
#else which is running despite if being met
else :
print("You lost! :( The word was " + random_word)
#sleep for 5 seconds so the terminal doesnt close
time.sleep(5)
The problem is when running the code it produces this: https://i.stack.imgur.com/tv7WN.png If anyone could share what I need to change I'd appreciate it