def setup():
student_name = ["ant","bird","cat","dog","eagle","frog"]
student_id = [58001,58010,58011,58100,58101,58110]
student_age = [39,25,19,30,22,18]
student_weight = [55,75,44,72,70,100]
student_height = [165,170,155,169,178,175]
display(student_name,student_id,student_weight,student_height)
def display(name,ID,weight,height):
print("Number of students with BMI > 25 =",find_numBMI_greaterthan25(weight,height))
i = 0
while(i < len(name)):
if(calBMI(weight[i],height[i]) > 25):
print("\nName :",name[i])
print("ID :",ID[i])
print("Weight :",weight[i])
print("Height :",height[i])
print("BMI : %.2f"%calBMI(weight[i],height[i]))
i += 1
def calBMI(weight,height):
highM = height/100
bmi = weight/(highM*highM)
return bmi
def find_numBMI_greaterthan25(weight,height):
i = 0
count = 0
while(i < len(weight)):
if(calBMI(weight[i],height[i]) > 25):
count += 1
i += 1
return count
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น