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

Find/count number of students with weight < 50

def setup():
   name = ["AA", "BB", "CC"]
   ID = [54321, 12345, 51234]
   age = [15, 25, 35]
   weight = [70, 45, 60]
   height = [1.60, 1.75, 1.50]
   print(count(weight))
 
def count(w):
   i = 0
   count = 0
   while(i < len(w)):
      if(w[i] < 50):
         count = count + 1
      i = i + 1
   return count

setup()

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

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