为什么我的递归python函数不返回?
def get_input(): my_var = input('Enter "a" or "b": ') if my_var != "a" and my_var != "b": print('You didn\'t type "a" or "b". Try again.') get_input() else: return my_varprint('got input:', get_input())
Type "a" or "b": a got input: a
Type "a" or "b": purple You didn't type "a" or "b". Try again. Type "a" or "b": a got input: None
get_input()
None
my_var
None
蝴蝶不菲
汪汪一只猫
慕丝7291255
波斯汪
相关分类