【发布时间】:2018-07-31 13:26:10
【问题描述】:
我应该能够更新这些破折号,以便当有人输入“a”时,破折号看起来像 a---a-。如果用户猜到字母“l”,破折号将看起来像 a---al。
magic_word = "animal"
dashes = "--------"
def get_guess()
while True:
print dashes
guess = str(input("Guess a letter: "))
if len(guess)>1:
print "Too long"
continue
elif not guess.islower():
print "Your guess must be one lowercase letter"
continue
if guess in magic_word :
print "That is in the word"
continue
else:
print "That is not in the word"
continue
return guess
break
get_guess()
【问题讨论】:
标签: python python-3.x python-2.7 python-requests