วันจันทร์ที่ 19 ตุลาคม พ.ศ. 2558

LAB 6 About BMI

def setup():
   name = ['fizz','talon','vayny','darious']
   iD   = [10161,10164,10163,10054]
   age  = [10,20,30,20]
   weight = [ 70 , 60 ,50 ,80]
   hight = [180 , 190 ,140,120 ]
   assert (count_numberBMI_more25(weight,hight)==2)
   display_student_BMImore25(weight,hight,name,iD,age)

def findBMI(weight,hight):
   BMI = weight / ((hight/100)*(hight/100))
   return BMI

def count_numberBMI_more25(weight,hight):
   i = 0
   count = 0
   while(i<len(weight)):
      if (findBMI(weight[i],hight[i])>25):
         count = count + 1
      i = i + 1
   return count

def display_student_BMImore25(weight,hight,name,iD,age):
   i = 0
   while(i < len (name)):
      if(findBMI(weight[i],hight[i])> 25):
         print ("###########################")
         print ("ID . ",iD[i])
         print ("name   is ",name[i])
         print ("age    is ",age[i])
         print ("weight is ",weight[i])
         print ("hight  is ",hight[i])
      i = i +1
 
setup()



###########################
ID .  10163
name   is  vayny
age    is  30
weight is  50
hight  is  140
###########################
ID .  10054
name   is  darious
age    is  20
weight is  80
hight  is  120

ไม่มีความคิดเห็น:

แสดงความคิดเห็น