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

[LAB6] WEIGHT data

def setup():
   names = [ "art", "bird", "cat"]
   student_id = [ 22, 24,17]
   ages = [ 30, 21, 17]
   weights = [ 72, 53, 49]
   heights = [ 168, 169, 181]
   #min_weight(names,weights)
   count_weight50down(names,weights)
 
def min_weight(names,weights):
   i = 0
   min_w = weights[i]
   min_n = 0
   while(i < len(weights)):
      if(min_w > weights[i]):
         min_w = weights[i]
         min_n = names[i]
      i = i + 1
   print(min_n)
   print(min_w)

def count_weight50down(names,weights):
   i = 0
   count = 0
   while(i < len(weights)):
      if(weights[i] < 50):
         count = count + 1
         print(names[i])
         print("Weights =",weights[i])
      i = i + 1
   #print("count_weight50down ="count)

setup()

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

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