题目:学习记录时间
1-记录学生学习 Python 的投入时间和有效时间。
2-需要你创建一个子类,为某一类学生提供定制化的记录方案。
class Student:
def __init__(self,name,job=None,time=0.00,time_effective=0.00):
self.name = name
self.job = job
self.time = time
self.time_effective = time_effective
def count(self,hour,rate):
self.time += hour
self.time_effective = self.time*rate
class Python(Student):
def __init__(self,name):
Student.__init__(self,name,job='python',time=0.00,time_effective=0.00)
student2 = Python('吴枫')
print(student2.job)
student2.count(10,1)
print(student2.time_effective)
student1 = Student('韩梅梅')
print(student1.job)
student1.count(10,0.8)
print(student1.time_effective)
网友评论