展开全部
想让程序循环,在62616964757a686964616fe78988e69d8331333431366335最外层套一个while就可以了,想跳出的时候写break就可以了。
在你的代码中,while不该套在if外面,其次像你这样判断直接用if,就可以了,不需要elseif,直接if效率更高。
想跳出,只要写条件执行break就行,比如下面我的代码中,输入N就结束,输入Y就继续。
while(1):
print('Welcome to use calculator of BMI exponent for human:')
w = float(input('Please enter your weight(kg):'))
h = float(input('Please enter your height(m):'))
BMI = w / (h * h)
if BMI < 18.5: print('you are thin !')
if 18.5 <= BMI <=24.9: print('you are normal !')
if BMI >=25: print('you are little fat !')
if 25.0 < BMI <=29.9: print('you are more little fat !')
if 30.0 <= BMI <= 34.9: print('you are fat !')
if 35.0 <= BMI <=39.9: print('you are serious fat !')
if BMI >=40: print('you are extreme fat !')
print('continue?Y/N')
n=''
while(n!='Y' and n!='N'):
n=input()
if(n=='N'):
break