action = input('Please enter add or del.\n')
def check_greeting1(action):
while True:
if action == '':
action = input("please enter add or del.\n")
else:
break
def get_input():
while True:
inputstr = input('Please enter add or del: ')
if inputstr == 'add' or inputstr == 'del'
return inputstr
else:
print('Wrong Input!')
将action = input('Please enter add or del.\n')放入while循环
def check_greeting1():
while True:
action = input('Please enter add or del.\n')
if not action:
action = input("please enter add or del.\n")
else:
break
请做吧。此函数反复询问用户,直到用户输入有效的输入值
将
action = input('Please enter add or del.\n')
放入while循环相关问题 更多 >
编程相关推荐