Sunday, November 1, 2015

Lab7 - Display student records with BMI > 25

class 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 bmi(self):
       
       
        bmi=self.weight/((self.height/100)*(self.height/100))
       
        if(bmi>25):
           
            print("Name : ",self.name)

            print("Weight : ",self.weight)

            print("Height : ",self.height)
           
            print("Your BMI is" ,bmi)

      

def setup():

    a = Student( "Antony" , 11 , 22 , 71 , 165 )

    b = Student( "Mike" , 12 , 23 , 66 , 171 )

    c = Student( "Jacky" , 23 , 21 , 58 , 162 )

    d = Student( "Bank" , 30 , 22 , 60 , 177 )

    e = Student( "Billy" , 1 , 20 , 62 , 180 )

    f = Student( "Biccy" , 3 , 24 , 62 , 181 )

    data = [a,b,c,d,e,f]

    bmi(data)


def bmi(data):

    i=0

    print("#### BMI ####")

    while(i < len(data)):

        data[i].bmi()
       
        print("")

        i+=1


setup()

No comments:

Post a Comment