department
course_list = ['python', 'linux']
class Student:
school = '老男孩上海校区'
Address = '上海虹桥'
course = None
def __init__(self, name1, age1, student_id1, gender1):
self.name = name1
self.age = age1
self.student_id = student_id1
self.gender = gender1
def choose(self):
print(f'学生{self.name}正在选课')
for index, i in enumerate(course_list):
print(index, i)
choice = input('请选课:').strip()
if not choice.isdigit():
print('请输入正确编号')
choice = int(choice)
if choice not in range(len(course_list)):
print('请输入正确编号')
course = course_list[choice]
print('已成功选课', course)
def info(self):
print(f'{self.name}{self.student_id}')
student1 = Student('egon', '84', 'dsb', 'unknown')
student2 = Student('sailan', '20', '101', 'male')
student3 = Student('tank', '30', '9527', 'male')
student3.choose()
student_dic = {
'sailan': None, '张三': None}
class Teacher:
school = '老男孩上海校区'
Address = '上海虹桥'
def __init__(self, name1, age1, salary1, lv1):
self.name = name1
self.age = age1
self.salary = salary1
self.lv = lv1
def choose(self):
print(f'老师{self.name}正在为学生打分')
for i in student_dic:
print(i)
choice = input('请输入学生姓名:').strip()
if choice in student_dic:
choice1 = input('请输入打的分数:').strip()
student_dic[choice] = choice1
print(student_dic)
else:
print('请输入正确的类型')
teacher1 = Teacher('egon', '84', '1', '-1')
teacher2 = Teacher('lxx', '20', '1', '1')
teacher3 = Teacher('tank', '30', '1', '1')
teacher1.choose()