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

Lab 7 - (Class) Display each student record

class student:
 
    def __init__(self,name,age,weight,height):
        self.name = name
        self.age = age
        self.weight = weight
        self.height = height
 
    def display(self):
        print(self.name, end = "   ")
        print(self.age, end = "   ")
        print(self.weight, end = "   ")
        print(self.height, end = "   ")
        print()
     
def setup():
    a = student("Buntun",18,50,160)
    b = student("FlukeKnub",19,75,199)
    c = student("PeeJa",19,60,160)
    d = student("Nutdech",18,58,185)
    e = student("BasBomba",20,60,180)
 
    a.display()
    b.display()
    c.display()
    d.display()
 
setup()
 

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

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