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

LAB 7 BMI if more print

def setup():
    A = data_student("A",100,15,80,160)
    B = data_student("B",101,18,56,162)
    C = data_student("C",102,28,96,182)
    data = [A,B,C]
    count = 0
    while(count<len(data)):
         if(find_student_BMI25(data[count].find_bmi())):
            data[count].display()
         count += 1
     
 
def find_student_BMI25(bmi):
   if(bmi>25):
      return True
   else:
      return False




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 find_bmi(self):
      self.bmi = self.weight/((self.height/100)**2)
      return self.bmi
 
setup()

.......................
ID IS  100
name   A
age    15
weight 80
height 160
.......................
ID IS  102
name   C
age    28
weight 96
height 182


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

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