Em làm bải tập quản lý nhân viên
nhưng khi em nhập các class vào thì python ko lưu nên ko thể print ra và tính toán được ạ
Anh chị nào có thể hướng dẫn em hoàn thành bài tập này ko ạ
em cám ơn anh chị
class sinhvien:
def __init__(self,mssv=None,ten=None,namsinh=None,Lop=None,nmlt=None,trr=None,ktlt=None,csdl=None):
self.ten=ten
self.mssv=mssv
self.namsinh=namsinh
self.lop=lop
self.nmlt=nmlt
self.trr=trr
self.ktlt=ktlt
self.csdl=csdl
def nhaplieu(self):
while True:
self.mssv=int(input("Nha MSSV: "))
self.ten=str(input("Nhap ten sinh vien: "))
self.namsinh=int(input("Nha nam sinh: "))
self.lop=str(input("Nhap lop: "))
self.nmlt=int(input("Diem nhap mon lap trinh: "))
self.trr=int(input("Diem toan roi rac: "))
self.ktlt=int(input("Diem ky thuat lap trinh: "))
self.csdl=int(input("Diem co so du lieu: "))
break
def tb(self):
trungbinh=(self.nmlt+self.trr+self.ktlt+self.csdl)/4
print("Diem trung binh: ",trungbinh)
def hienthi(self):
print(self.mssv," ",self.ten," ",self.namsinh," ",self.lop," ",self.nmlt," ",self.trr," ",self.ktlt," ",self.csdl," ")
def main():
print("CHUONG TRINH QUAN LY HOC TAP")
print("1.Nhap tong tin sinh vien")
print("2.In thong tin sinh vien")
print("3.So luong sinh vien co diem trung binh lon hon 5")
print("4.So luong sinh vien co diem trung binh nho hon 5")
print("5.In so luong sinh vien duoc nhan hoc bong")
print("0.Thoat")
a=int(input("Moi nhap lua chon: "))
if a==1:
whale=sinhvien()
whale.nhaplieu()
main()
elif a==2:
whale.sinhvien()
whale.hienthi()
whale.tb()
main()
main()