Home > other >  Learning python language difficulties, ask for help
Learning python language difficulties, ask for help

Time:02-08

I didn't reach effect after written and infinite loop
Procedure is as follows: (bold part is where the error)
# the computer randomly select a word, tell the players the word length
# the player to guess, and five times opportunity to ask computer
Import the random
# to create a set of optional word
WORDS=(" python ", "jumble", "easy", "about" and "answer", "xylophone")
# randomly selected a word
The word=the random choice (WORDS)
# to create the right answer variable
Correct word=
# start the game
Print (" ", "
I will tell you a (n) word 's len.
You guess.
You can ask me been a letter in this word.
You have 5 chances.

"" ")
Print (" it 's len is, "len (correct))
Guess=input (" Your guess: ")
I=0
while guess!=correct and I & lt;=5:
Print (" That 's not it ")
Print (" You can ask me been a letter in this word. ")
Help=(input (' So, don \ 't you want to ask me? "Yes" or "No" : ')). The lower
If help=='yes' :
I +=1
Letter=input (' The letter you guess is: ')
If letter in correct:
Print (' Yes, ', letter, 'is in this word.)
The else:
Print (' No, ', letter, 'is not in this word.)
Guess=input (" both please guess again: ")
The else:
Guess=input (" both please guess again: ")

If guess==correct:
Print (" That 's it!" )
if i <=3:
Print (" Your grade is 10. "
Elif I & gt; 3 and I & lt;=4:
Print (" Your grade is 8. "
Elif I & gt; 4:
Print (" Your grade is 6. "
The else:
Print (" Sorry, you don 't guess it and your chance is exhausted ")
Print (" Your grade is 1."
  • Related