My code has an error

My code has an error and i cant find any mistake:

Repl link

import random
import os
print("Hello and welcome to wordle")
print("When you enter a word make sure it follow the below requirement\n5 letters in length\nno special characters\n")
input("Press enter to begin")
os.system("clear")
word = ["brand"]
truth = True
while truth:
	for i in range(5):
		guess = input("enter a word:  ")
		guess = guess.lower()
		if word.find(guess[0]) >= 0:
			new = guess[0].lower() + guess[1:5]
			guess = new
		if word.find(guess[1]) >= 1:
			new = guess[0:1] + guess[1].lower() + guess[2:5]
			guess = new
		if word.find(guess[2]) >= 2:
			new = guess[0:2] + guess[2].lower() + guess[3:5]
			guess = new
		if word.find(guess[3]) >= 3:
			new = guess[0:3] + guess[3].lower() + guess[4]
			guess = new
		if word.find(guess[4]) >= 4:
			new = guess[0:4] + guess[4].lower()
			guess = new
		if word[0] == guess[0]:
			output = guess[0].upper()+guess[1:5]
			guess = output
		if word[1] == guess[1]:
			output = guess[0] + guess[1].upper() + guess[2:5]
			guess = output
		if word[2] == guess[2]:
			output = guess[0:2] + guess[2].upper() + guess[3:5]
			guess = output
		if word[3] == guess[3]:
			output = guess[0:3] + guess[3].upper() + guess[4:5]
			guess = output
		if word[4] == guess[4]:
			output = guess[0:4] + guess[4].upper()
			guess = output
		if word.find(guess[0].lower()) < 0:
			new = "_" + guess[1:5]
			guess = new
		if word.find(guess[1].lower()) < 0:
			new = guess[0:1] + "_" + guess[2:5]
			guess = new
		if word.find(guess[2].lower()) < 0:
			new = guess[0:2] + "_" + guess[3:5]
			guess = new
		if word.find(guess[3].lower()) < 0:
			new = guess[0:3] + "_" + guess[4]
			guess = new
		if word.find(guess[4].lower()) < 0:
			new = guess[0:4] + "_"
			guess = new
		if guess.lower() == word.lower():
			width = os.get_terminal_size().columns
			print("Congrats!!! you won".center(width))
		print(guess)


	

does anyone know what the error is when i execute it say this
image

Hi @TheOtherGuy thanks for your message.

find isn’t an function that can be used on a list in Python. Are you maybe confusing languages?

Try this:
image

im not making a list

oh wait yeah word is a list

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.