def setup():
names=["Jack",'John','James','Jane']
idNo=['5801','5802','5803','5804']
age=[18,32,15,41]
weight=[60,99,72,50]
height=[150,162,170,159]
listthedata(names,idNo,age,weight,height)
find_moreBmi25(names,weight,height)
def listthedata(names,idNo,age,weight,height):
i=0
while(i<len(names)):
print('Name : ',names[i],' ID NO.: ',idNo[i],' Age: ',age[i])
print('Weight: ',weight[i],' Height: ',height[i],' BMI: %.2f'%cal_bmi(i,weight,height))
print()
i=i+1
def cal_bmi(i,weight,height):
bmi=(weight[i])/((height[i]/100)**2)
return bmi
def find_moreBmi25(names,weight,height):
i=0
n=0
while(i<len(names)):
if(cal_bmi(i,weight,height)>25):
print(names[i],'has BMI > 25.')
n=n+1
i=i+1
print(n,' students that have BMI > 25.')
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น