import teacherfunc
class Teacher:
__name = ""
__user = ""
__class = ""
__passwd = ""
def __init__(self, name, user, clas, passwd):
self.__name = name
self.__user = user
self.__class = clas
self.__passwd = passwd
def set_name(self, name):
self.__name = name
def get_name(self):
return self.__name
def set_user(self, user):
self.__user = user
def get_user(self):
return self.__user
def set_class(self, clas):
self.__class = clas
def get_class(self):
return self.__class
def set_passwd(self,passwd):
self.__passwd = passwd
def get_passwd(self):
return self.__passwd
mrhall = Teacher("Stuart Hall", "halls", "Class_A", "passwd")
mrkasanda = Teacher("Kasanda", "kasandam", "Class_B", "passwd")
mrbeasley = Teacher("Bradley Beasley", "beasleyb", "Class_C", "passwd")
userinp = input("What teacher are you: ")
for field in [mrhall, mrkasanda, mrbeasley]:
if field.__user == userinp.lower():
usr = field
print("Welcome", usr.__passwd)
passinp = input("Enter your password to get class scores: ")
while passinp != usr.__passwd:
passinp = input("Enter your password to get class scores: ")
teacherfunc.main(usr.__user)
the teacherfunc main() function is a function that allows the user to view data but is not the problem. it gives an attribute error saying that the class Teacher does not have an attribute named __user, but it quite obviously isn't. I would be very grateful if you could help. thanks.