我试图找出如何在不重复的情况下重复我的程序(代码),但我读过的所有答案都没有意义。那么有人可以帮助我吗?这是我正在研究的程序
import random
words=['hello','run','apple','day','month','cat','dog','bird','car','water']
word=random.choice(words)
length=len(word)
life=50
print('\t\tGuess the word!')
print('instructions: Guess the word. The word is only written by the alphabets.')
pn=input('Type your player name :')
print('Use this to help you! :',words)
print('The length of the word is',length,'letters')
fl=input('Guess the first letter of the word! :')
if fl==word[0]:
print('Whoah! Nice guess',pn)
else:
life=life-1
print('Nice guess but wrong. Try again! You have',life,'lives left!')