简体   繁体   English

student() 没有 arguments 错误。 我试图检查一切都可以请任何人帮助我解决它

[英]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.

相关问题 当我尝试将我的 Django 项目部署到 Heroku 时,它没有检测到 buildpack。 有人可以帮我吗? - When I tried to deploy to Heroku my Django project it is not detecting the buildpack. Could anyone help me please? 当我运行heroku ps:scale web = 1命令时,出现此错误。 谁能帮我这个 - When i run heroku ps:scale web=1 command i am getting this error. Can anyone help me with this (NoReverseMatch at / Reverse for 'detail' with arguments '(1,)' not found. 1 模式尝试:['<int:id> /'])。 请帮我删除这个错误</int:id> - (NoReverseMatch at / Reverse for 'detail' with arguments '(1,)' not found. 1 pattern(s) tried: ['<int:id>/']). please help me to remove this error 您好,当我在 Jupyter 笔记本中执行此查询时,它会显示错误。 请帮帮我 - Hello When I execute this query in my Jupyter notebook it shows me error. Please help me out 我在pygame中创建移动平台时遇到了麻烦。 我遇到错误,有人可以帮我吗? - I am having trouble creating moving platforms in pygames. I am getting an error, can anyone help me out please? 我尝试打开一个 python 文件并得到了这个,请任何人帮忙 - i tried opening a python file and got this, please can anyone help out 在 GOOGLE COLAB 中运行此 python 代码时,它向我显示错误。 谁能告诉我我做错了什么并分享更正的代码? - On running this python code in GOOGLE COLAB, it showing me error. Can anyone please tell what am i doing wrong and share a corrected code? 嗨,我有一个 python 脚本可以使用 openpyxl 处理 excel 数据,但是在 2500 行之后我收到 Memory 错误。 谁可以帮我这个事? - Hi, I have a python script to work with excel data using openpyxl ,but after 2500 rows i am getting Memory Error. Can anyone help me on this? 任何人都可以帮我找到错误“AttributeError:'Example' object has no attribute 'src_len'”的解决方案吗? - Can Anyone please help me in finding the solution to the error "AttributeError: 'Example' object has no attribute 'src_len'"? 我在我的代码中使用了 Selenium,但我一直收到错误。 谁能帮忙?” - I'm using Selenium in my code, but I keep getting an error. Can anyone help?"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM