所以我正在练习用python编码。如果我需要返回一个数字,我总是使用 return 语句,所以我什么也得不到。但是现在当我只想打印出评论时,它不会返回任何内容。即使我尝试使用 return 语句,它也会返回 none。
def name_tag():
name = input("Hello, whats your name? : ")
print(f'Hi {name}, would you like to play a game?')
print(y_n())
def y_n():
yes_no = input("Y/N: ")
if yes_no.lower() == 'y':
print('Cool, than lets play a game')
elif yes_no.lower() == 'n':
print('To bad!')
else:
print('Please anwser with [y] or [n]')
print(y_n())
这是输出
Hello, whats your name? : jop
Hi jop, would you like to play a game?
Y/N: k
Please anwser with [y] or [n]
Y/N: y
Cool, than lets play a game
None
None
None
临摹微笑
繁华开满天机
DIEA
相关分类