name = ['jinx','Vi','Kat','Zed']
ID = [58102,58201,58101,58202]
age = [18,19,17,16]
weight = [44,65,70,70]
height = [164,169,162,180]
print("Let's have a look who got BMI over 25")
assert(count_over_25_BMI(weight,height)==1)
find_over_25_BMI(name,ID,age,weight,height)
def BMI(weight,height):
BMI = weight/((height/100)**2)
return BMI
def count_over_25_BMI(weight,height):
i = 0
count = 0
while(i<len(weight)):
if(BMI(weight[i],height[i])>25):
count+=1
i+=1
return count
def find_over_25_BMI(name,ID,age,weight,height):
i = 0
#BMI = 25
while(i<len(weight)):
if(BMI(weight[i],height[i])>25):
print('name :',name[i])
print('ID :', ID[i])
print('age :',age[i])
print('weight :',weight[i])
print('height :',height[i])
print('BMI :',BMI(weight[i],height[i]))
print('\n')
i+=1
setup()
Result
Let's have a look who got BMI over 25 name : Kat ID : 58101 age : 17 weight : 70 height : 162
BMI : 26.672763298277697
ไม่มีความคิดเห็น:
แสดงความคิดเห็น