写python的时候遇到了这样的一个报错:

问题遇到的现象和发生背景

写python的时候遇到了这样的一个报错:
init() missing 2 required positional arguments: 'name' and 'age'

用代
class Student:
    count = 0
    def printnum(self):
        print('count={}'.format(self.count))
    def __init__(self,name,age):
        self.name = name
        self.age = age
    def printstu(self):
        print('name={},age={}'.format(self.name,self.age))
if __name__=='__main__':
    s1 = Student()
    s2 = Student('Tom','18')
    print('s1.count={}'.format(s1.count))
    s1.printnum()  
    s1.count='hello'
    print('Student.count={}'.format(s1.count))
    s2.printstu()
    print('name={} age={}'.format(Student.name,Student.age))



```码块功能插入代码,请勿粘贴截图 

###### 运行结果及报错内容 
预期输出: s1.count=0
                count=0
                Student.count=hello
                s2.name=Tom,s2.age=18
                name=Tom age=18
实际输出: 

```python

Traceback (most recent call last):
  File "src/step1/pratise_1.py", line 12, in 
    s1 = Student()
TypeError: __init__() missing 2 required positional arguments: 'name' and 'age'
我的解答思路和尝试过的方法

百度搜过,但是没有结果

我想要达到的结果

帮我解答一下这个报错的出现原因

img

s1 = Student() 你这里实例化的时候没有传名字和年龄

因为你只写了一个有参的构造函数,无参的构造函数没有定义,所以s1 = Student()这样是不行的
如果你还想要一个无参的构造函数,python不支持重载
你可以这样定义函数def __init__(self,name=str(),age=0):