Resultdef setup():
name = ['jinx','Vi','Kat','Zed']
ID = [58102,58201,58101,58202]
age = [18,19,17,16]
weight = [44,65,70,70]
height = [164,169,162,180]
print("Let's have a look who got weight less than 50")
assert(count_weight_less_than_50(weight)==1)
find_weight_less_than_50(name,ID,age,weight,height)
print('minimum weight of students is',find_minimum_weight(name,ID,age,weight,height))
def count_weight_less_than_50(weight):
i = 0
count = 0
while(i<len(weight)):
if(weight[i]<50):
count+=1
i+=1
return count
def find_weight_less_than_50(name,ID,age,weight,height):
i = 0
while(i<len(weight)):
if(weight[i]<50):
print('name :',name[i])
print('ID :', ID[i])
print('age :',age[i])
print('weight :',weight[i])
print('height :',height[i])
print('\n')
i+=1
def find_minimum_weight(name,ID,age,weight,height):
i = 0
minimun_weight = weight[i]
while(i<len(weight)):
if(minimun_weight>weight[i]):
minimun_weight = weight[i]
i = i+1
return minimun_weight
setup()
วันศุกร์ที่ 23 ตุลาคม พ.ศ. 2558
Lab6-- Display student records with weight < 50
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น