love

วันอาทิตย์ที่ 25 ตุลาคม พ.ศ. 2558

Lab6 - Find/count number of students with BMI > 25

def setup():
    name = ["Boss" ,"Oat" ,"Nook" ,"Nun" ,"Noy"]
    number = [1,2,3,4,5]
    age =  [38 ,18 ,20 ,17 ,40]
    weight = [80 ,50 ,55 ,52 ,60]
    height = [160 ,163 ,160 ,160 ,156]
    display(name,number,age,weight,height)
 
def display(name,id,age,w,h):
    i = 0
    count = 0
    while(i<len(name)):
        if(w[i]/((h[i]/100)*(h[i]/100))>25):
               print("Name: ",name[i])
               print("Student ID: ",id[i])
               print("Age : ",age[i])
               print("Weight : ",w[i])
               print("Height : ",h[i])
               print("BMI : " ,w[i]/((h[i]/100)*(h[i]/100)))
               print("")
               count = count + 1
        i = i+1
    print("BMI more than 25 : " ,count)
setup()

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

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