A
A
Abobus Amogusovich2021-11-06 03:21:15
Python
Abobus Amogusovich, 2021-11-06 03:21:15

Why does the method not see the arguments?

The task was given: to create a class, a method to it and a class object, set its attributes and call the method. But the error "Student() takes no arguments" comes out.

I don't really understand why, everything works in the lecture :/

class Student():
    def __init__(self,name, group,spec):
        self.name = name
        self.group = group
        self.spec = spec

class Student:
    def study(self):
        print ('your name', self.name)
        pass

Mvgr = Student('kolya',61,'bank')
Mvgr.study()
print(Mvgr.study())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stefan, 2021-11-06
@MEDIOFF

class Student:
    def study(self):
        print ('your name', self.name)
        pass

Do you see your class accepting arguments?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question