让用户键入要确认的单词的随机单词生成器的源代码
def word_list():
import random #Import random function
words = ['hello',"yes","no","I","look","where","can","he","with","see","do","we","a","you","play","am","what","one","the","this","have","on","want","go","like","and","hurt","to","under","day","is","or","of","it","are","said","big","up","that","little","down","there","my","she","out","good","her","all","yes","make","read","no","they","your\n"]
question = random.choice(list(words)) #Generates a random word from the list
print(question) #Displays the word that was generated
answer = input('Retype the word and press enter:') #User retypes the
while True: #Loop that allows user to
if answer == question: #If statement that confirms the user spelled the word right
print('Great job you spelled it correctly!')
input('Press enter for another word')
else:
while answer != question:
print('You spelled that word wrong, please try again!')
answer = input('Retype the word and press enter:')