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

[LAB6] BMI data

def setup():
   names = [ "art", "bird", "cat"]
   student_id = [ 22, 24,17]
   ages = [ 17, 18, 19]
   weights = [ 72, 53, 51]
   heights = [ 168, 169, 181]
   BMI(names, weights, heights)
 
def BMI(names, weights, heights):
   i = 0
   count = 0
   while(i < len(names)):
      BMI = weights[i]/((heights[i]/100) * (heights[i]/100))
      #print(names[i],"BMI =","%.2f"%BMI)
      if(BMI > 25):
         count = count + 1
         print("count_bmi25up =",count)
         print(names[i])
         print("weight", weights[i])
         print("height", heights[i])
         print("BMI =", "%.2f"%BMI)
      i = i + 1
     
setup()

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

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