Sunday, October 25, 2015

Lab7 - Display each student record

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 display(self):
        print("Name : ",self.name)
        print("ID : ",self.id)
        print("Age : ",self.age)
        print("Weight : ",self.weight)
        print("Height : ",self.height)
       
def setup():
    a = Student( "Antony" , 11 , 22 , 65 , 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 )
    call = [a,b,c,d,e,f]
    record(call)

def record(call):
    i=0
    print("#### Student record ####")
    while(i < len(call)):
        call[i].display()
        print("")
        i+=1

setup()

No comments:

Post a Comment