วันอังคารที่ 24 พฤศจิกายน พ.ศ. 2558

Lab 6 : Find/count number of students with age < 30

def setup():
   name = ["Mum" , "Teng" , "Nong" , "Tukky"]
   height = [161,175,177,155]
   weight = [62,54,86,71]
   age = [25,18,52,43]
   i = 0
   count = 0
   while(i<len(age)):
      if(age[i]<30):
         count = count+1
         print(name[i]," = ",age[i]," years old")
      i = i+1
   print("Total student age<30 = ",count)


setup()

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

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