[英]student() takes no arguments error. I tried to check everything can anyone please help me in solving it
class Student:
def __init__(self,name,age,grade):
self.name = name
self.age = age
self.grade = grade # 0 - 100
def get_grade(self):
return self.grade
class Course:
def __init__(self,name,max_students):
self.name = name
self.max_students = max_students
self.students = []
def add_student(self,student):
if len(self.students)<self.max_students:
self.students.append(student)
return True
return False
def get_average_grade(self):
pass
I am getting error as follows, I have added two underscore also don't knwo where I am getting this wrong我收到如下错误,我添加了两个下划线也不知道我哪里出错了
you are using a lower-case s when creating the instance您在创建实例时使用了小写的 s
It looks like you're using the wrong case.看起来您使用了错误的案例。 You want
Student
, not student
.你想要
Student
,而不是student
。
Resolved this error, the error was associated to case sensitivity.解决了这个错误,这个错误与区分大小写有关。 Student call should use Student(argument_1,argument_2) used student.
学生调用应该使用 Student(argument_1,argument_2) 使用的学生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.