A = data_student("A",100,10,30,160)
B = data_student("B",101,5,26,162)
C = data_student("C",102,15,96,182)
D = data_student("D",103,4,70,160)
data = [A,B,C,D]
print("minimun weight is",find_minimum(data))
print("count number weight below 50 is",count_weight_low50(data))
display_low50(data)
def display_low50(data):
count = 0
while(count<len(data)):
if(check_low50(data[count].replay_weight())):
data[count].display()
count +=1
def check_low50(data):
if(data<50):
return True
return False
def count_weight_low50(data):
count = 0
result = 0
while(count<len(data)):
if(check_low50(data[count].replay_weight())):
result += 1
count += 1
return result
def find_minimum(data):
count = 0
result = data[0].replay_weight()
while(count<len(data)):
if(data[count].replay_weight()<result):
result = data[count].replay_weight()
count += 1
return result
class data_student():
def __init__(self,name,iD,age,weight,height):
self.name = name
self.iD = iD
self.age = age
self.weight = weight
self.height = height
def display(self):
print(".......................")
print("ID IS ",self.iD)
print("name ",self.name)
print("age ",self.age)
print("weight",self.weight)
print("height",self.height)
def replay_weight(self):
return self.weight
setup()
minimun weight is 26 count number weight below 50 is 2 ....................... ID IS 100 name A age 10 weight 30 height 160 ....................... ID IS 101 name B age 5 weight 26 height 162
ไม่มีความคิดเห็น:
แสดงความคิดเห็น