• Register
2 votes
285 views

Problem:

I was working on a project where I was trying to implement a subclass. The code I wrote for that was:
class OverViewOfWork(Utilities.Utility):
    def TotalHourWorked():
        pass    
    def DaysWorked():
        pass
    def AvarageWorks():
        pass
    def Salary():
        pass  

But it throws some error like:

TypeError: TotalHourWorked() takes 0 positional arguments but 1 was given
TypeError: DaysWorked() takes 0 positional arguments but 1 was given
TypeError: AvarageWorks() takes 0 positional arguments but 1 was given
TypeError: Salary() takes 0 positional arguments but 1 was given

What is the problem here?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

2 votes

Answer:

In your code you need add a parameter which is called 

self

to all of your function in the class OverViewOfWork

So write your code like:

class OverViewOfWork(Utilities.Utility):
    def TotalHourWorked(self):
        pass    
    def DaysWorked(self):
        pass
    def AvarageWorks(self):
        pass
    def Salary(self):
        pass  

Let me know if it is working for you or not. Happy coding.

11 6 4
34,950 points

Related questions

0 votes
1 answer 17 views
17 views
Problem: How to I Solve this: module.__init__() takes at most 2 arguments (3 given) HELP! I need help understanding this: module.__init__() takes at most 2 arguments (3 given) Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked Mar 7 Mashhoodch 13k points
0 votes
1 answer 4 views
4 views
Problem: As i posted one more question related to this, and now i have one more problem, can anyone help me out?
asked Apr 4 niyatiry 3.2k points
0 votes
2 answers 6 views
6 views
Problem: Yesterday, when i opened my computer I face this problem then i tried to sloved it but i can't able to, can anyone help me out?
asked Apr 4 niyatiry 3.2k points
0 votes
1 answer 8 views
8 views
Problem: Please help me to solve it... python takes 1 positional argument but 2 were given
asked Apr 2 Ifra 24.4k points
0 votes
1 answer 19 views
19 views
Problem: I am stuck with this ... Please help me that how to deal with this error?
asked Mar 12 Ifra 24.4k points
1 vote
1 answer 599 views
599 views
Problem : I am a Computer Science Student. I want to develop my website by using Django 2.1.3 and python 3.7.1. If I try to go to my websites homepage then i often face below error: Traceback: File "C:\Users\Martin\AppData\Local\Programs\Python\ ... TypeError at / Exception Value: __init__() takes 1 positional argument but 2 were given Please guide me in fixing my above django related error.
asked May 14, 2020 Martin K 6.6k points
0 votes
1 answer 14 views
14 views
Problem: Please help me … how can I solve it?
asked Mar 12 Ifra 24.4k points
0 votes
1 answer 160 views
160 views
Problem: Input() function in python is used to get a input value from the command prompt, when the program executes the input() function will display a message(says wat the input is for). it just takes one argument.
asked Feb 17 Mashhoodch 13k points
0 votes
1 answer 8 views
8 views
Problem: The program is supposed to take in two names, and if they are the same length it should check if they are the same word. If it's the same word it will print "The names are the same". If they are the same length but with different letters it will print "The names are different ... than '{1}'"% name1, name2) elif len(name1) < len(name2): print ("'{0}'is longer than '{1}'"% name2, name1)
asked Feb 16 Mashhoodch 13k points
0 votes
1 answer 5 views
5 views
Problem: how to I Solve this: only named arguments may follow *expression HELP! I need help understanding this: only named arguments may follow *expression Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked Mar 10 Mashhoodch 13k points