The word I type is “coconut”, since it is not in my array, I want it to show an output of “Incorrect Spelling”. How can I do that?
Also how can I remove the already use name of fruits in the list when it’s been already called or typed then load it again when the game starts again?
Thank you in advance for the help!!
var input = "coconut" # change this line to change input
var input_exists = false
for member in lines: # loop through all members of lines
if(input == member): # if the member is the same as the input
input_exists = true # signal that the input was found in lines
lines.erase(member) # remove the member from lines
break # exit the loop, since a matching member of lines has been found
if(input_exists):
pass # This will execute if the user input was found in lines
else:
print("Incorrect Spelling") # This will execute if the user input was not found in lines