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

Find/count number of students with BMI > 25

def setup():
   name = ["AA", "BB", "CC"]
   ID = [54321, 12345, 51234]
   age = [15, 25, 5]
   weight = [70, 55, 60]
   height = [1.60, 1.75, 1.50]
   print(count(name, weight, height))
 
def count(n, w, h):
   i = 0
   count = 0
   while(i < len(n)):
      BMI = w[i]/(h[i]*h[i])
      if(BMI > 25):
         count = count + 1
      i = i + 1
   return count
   
setup()

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

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