I would like to create a program in Python 3 which allows the user to enter the amount of letters the word has, and the some letters.
For instance:
>> Input how many letters there are in the word
> 5
>> Put _ if no letter is shown, and letter that is shown down
> _ell_
>> Possible finds: Hello, Mello
>> Update the search
> Hell_
>> Final find: Hello
>> Restart?:
> Yes
I don't really know how to explain this in proper words, but you are developers as said so I'm sure you understand that.
You let the user input the amount of letters that are in the word.
Then you let the user input _
as blank letters and proper letters as they are shown (st_ing >> string
)
Then it will come up with some words that match that search that is from a dictionary array or a text file (By array I mean words = ["word1", "word2", word3"]
etc..)
Then you can type to narrow the search if there are no more than 1 find
Once there is only 1 find, it will prompt to restart, and then yes = restart.
I'm new to python so this is probably the most complicated for me, that is why I'm asking you!
I'm asking how complicated would this be and if it is even possible, how would I go about it. I have started it, here is all I have right now: (Keep in mind I just started)
two_word = ["hi", "ai", "no", "id"]
three_word = ["run", "buy", "tie", "bit", "fat"]
four_word = ["help", "file", "edit", "code", "user"]
five_word = ["couch", "cough", "coach", "stars", "spoon", "sunny", "maths"]
letter_count = input("How much letters are there?: ")
letter_count = int(letter_count)
if letter_count == 2:
wordlist = two_word
elif letter_count == 3:
wordlist = three_word
elif letter_count == 4:
wordlist = four_word
elif letter_count == 5:
wordlist = five_word
else:
print("Improper entry.")
guess = input("The word right now: ")
blanks = guess.count("_")
#I don't know how to check for certain letters and how to convert _ to the word in the wordlist
#That is why I'm asking