May I kindly ask you for help.
I must write a program in python for homewrok which it asks two competitors alternately for one single letter. The program is over when there is no such word in dictionary (I imported dictionary which it is in text format that I get from teacher).
Here is how it should look like:
Competitor 1, letter a: m
Competitor 2, letter b: o
Competitor 1, letter a: u
Competitor 2, letter b: s
Competitor 1, letter a: e
Competitor 2, letter b: i
There is no such word mousei in dictionary!
And here is how I started:
dictionary=open("dictionary.txt", encoding="latin2").read().lower().split()
a=input("Competitor 1, letter a:")
b=input("Competitor 2, letter b:")
word=a+b
while word in dictonary:
a=input("Competitor 1, letter a:")
word=word+a
b=input("Competitor 2, letter b:")
word=word+b
print("There is no such word" ,word, "in dictionary!")
But something is wrong. Because when I start program and I write first two letters. It says there is no such word in dictionary.
Please help me!
One more thing: The game must stop immediately after the first wrong character. Could you please show how to make this.