password = input('Do you wish to add a camper, answer with yes or no:')
while password == 'no':
paid = int(input('How much money have you paid:'))
name = input('What is the camper\'s name:')
if paid == '120':
print(name, 'Your sport is football')
if paid == '200':
print(name, 'Your sport is Basketball')
password = str(input('Do you wish to add a camper, answer with yes or no:'))
if paid == '225':
print(name, 'Your sport is Netball')
password = str(input('Do you wish to add a camper, answer with yes or no:'))
if paid == '275':
print(name, 'Your sport is Hockey')
password = str(input('Do you wish to add a camper, answer with yes or no:'))
if paid == '300':
print(name, 'Your sport is swimming')
password = str(input('Do you wish to add a camper, answer with yes or no:'))
输出
runfile('C:/Users/camro_803vhwj/Desktop/ITSBA inpython.py', wdir='C:/Users/camro_803vhwj/Desktop')
Do you wish to add a camper, answer with yes or no:yes
当我需要所有3个提示时,上面的输出是唯一的输出。 如何获得获取的提示;姓名、付款和密码是否会一个接一个发生
不确定你想让程序做什么,但可能是这个:
我相信下面的代码可以完成这项工作
我认为“else”是必要的,但如果您愿意,请删除它
当密码==“否”时更改此行:将密码更改为while password!='否: 如果用户输入字符串“no”,则退出循环
相关问题 更多 >
编程相关推荐