วันจันทร์ที่ 26 ตุลาคม พ.ศ. 2558

Lab 6 - Find minimum weight, weight < 50, Display records

def setup():
   student_id=[1,2,3,4,5]
   names=["A","B","C","D","E"]
   age=[15,16,23,26,21]
   weight=[43,55,60,54,63]
   height=[175,171,187,181,183]
   find_weight(student_id,names,age,weight,height)
 
def find_weight(student_id,names,age,weight,height):
   i=0
   minimun_weight=weight[1]
   count=0
   while(i<len(weight)):
      if(weight[i]<minimun_weight):
         minimun_weight=weight[i]
      if(weight[i]<50):
         count=count+1
         print(student_id[i],"  ",names[i],"       ",weight[i],"  kg")
      i=i+1
   print("student have weight less than 50 = ",count)
 
setup()

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

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