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

Lab 6 : Find/count number of students with weight < 50

def setup():
   names=["a","b","c"]
   IDs=[123,456,789]
   ages=[20,25,30]
   weights=[50,67,71]
   heights=[164,175,151]
   print("number of students with BMI < 50 :",count_weight(weights))

def count_weight(weight):
   i = 0
   num = 0
   for i in range(0, len(weight)):
      if(weight[i]<50):
         num = num+1
   return num

setup()

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

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