class Course: def init(self, number, name, teacher, location): self.number = number self.name = name self.teacher = teacher self.__location = location

def show_info(self):
    print('课程编号:', self.number)
    print('课程名称:', self.name)
    print('任课教师:', self.teacher)
    print('上课地点:', self.__location)

course = Course('001', 'Python编程', '张老师', 'A201') course.show_info()

Python 课程类设计与应用 - 包含编号、名称、教师、地点属性

原文地址: https://www.cveoy.top/t/topic/mMFk 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录