实现类时出现Python错误

实现类时出现Python错误,python,class,Python,Class,我正在努力完成这门课,不知道为什么我在尝试构建时总是出错 这就是错误: class DetailedScore(Score): '''A subclass of Score adding level''' def __init__(self, points, initials, level): ''' (Score, int, str, int) -> NoneType Create a score including numbe

我正在努力完成这门课,不知道为什么我在尝试构建时总是出错

这就是错误:

class DetailedScore(Score):
'''A subclass of Score adding level'''

    def __init__(self, points, initials, level):
        '''
        (Score, int, str, int) -> NoneType

        Create a score including number of points, initials, and level.
        '''

        super().__init__(points, initials)
        self.level = level

    def __str__(self):
        '''
        Return a string representation of DetailedScore formated:

        'The student with initials 'KTH' scored 100 points, the student is in level 10'
        '''

        score_str = super().__str__()

        return '{}, the student is in level {}'.format(score_str, self.level)

    def __repr__(self):
        '''
        Return a string representation of DetailedScore formated:

        'DetailedScore(100, 'KTH', 10)'
        '''

        return 'DetailedScore({}, {}, {})'.format(self.points, self.initials, self.level)

score5 = DetailedScore(1000, 'JQP', 100)
score6 = DetailedScore(999, 'ABC', 99)
score7 = DetailedScore(999, 'BBB', 15)
score8 = DetailedScore(1, 'KTH', 12)
回溯(最近一次呼叫最后一次):
文件“/Users/KoryHershock/Documents/Python/[Kory_Hershock]\u final.py”,第187行,在
分数5=详细分数(1000分,'JQP',100分)
文件“/Users/KoryHershock/Documents/Python/[Kory\u Hershock]\u final.py”,第162行,在__
超级()
TypeError:super()至少接受1个参数(给定0个)
[在0.1s内完成,退出代码为1]

super()。\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu


Python3也允许无参数形式,编译器插入从词法上下文获取的适当类对象。

如果使用Python2,则必须编写
super(DetailedScore,self)
,而不是
super()


Python 3也允许无参数形式,编译器插入从词法上下文中获取的适当类对象。

我的计算机上安装了Python 3,如何让Sublime Text 2运行它?或者如何通过终端运行python 3?@KoryHershock python 3可执行文件通常称为
python3
。如何在Sublime中设置它可能是在一个与Sublime相关的论坛上最好的问题。我的计算机上安装了python 3,我如何让Sublime Text 2运行它?或者如何通过终端运行python 3?@KoryHershock python 3可执行文件通常称为
python3
。如何在Sublime中设置它可能最好在Sublime相关论坛中询问。感谢您的回复,尝试运行安装在我计算机上的python3,我将如何使Sublime Text 2运行它?或者,我将如何在终端中使用python3运行该程序?感谢您的回复,尝试运行安装在我计算机上的python3,我将如何使Sublime Text 2运行它?或者,我将如何使用python3在终端中运行该程序?
Traceback (most recent call last):
  File "/Users/KoryHershock/Documents/Python/[Kory_Hershock]_final.py", line 187, in <module>
    score5 = DetailedScore(1000, 'JQP', 100)
  File "/Users/KoryHershock/Documents/Python/[Kory_Hershock]_final.py", line 162, in __init__
    super().__init__(points, initials)
TypeError: super() takes at least 1 argument (0 given)
[Finished in 0.1s with exit code 1]