• Register
2 votes


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():
    def DaysWorked():
    def AvarageWorks():
    def Salary():

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,050 points

1 Answer

2 votes


In your code you need add a parameter which is called 


to all of your function in the class OverViewOfWork

So write your code like:

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

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

11 6 4
34,930 points

Related questions

1 vote
1 answer 147 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 Martin K 6.6k points
1 vote
1 answer 140 views
Problem: I was trying open some file using python and I wrote the code: import numpy as np doland = open('talks.txt', encoding='utf8').read() holland = open('h-talks.txt', encoding='utf8').read() print(doland) But the code always hrows a error ... ^ TypeError: 'encoding' is an invalid keyword argument for this function Whats problem in my code please help me to solve this. Thanks in advance.
asked Apr 21 samhaz 5k points
0 votes
1 answer 38 views
Problem: I have freshly migrated my project from the old python2 to the new python3 and it has hundreds of the ForeignKey relations. I have very basic knowledge related to python. Using a solution to go line by line and add on_delete argument is not the possible. What ... it does not look like catching it somehow. Looking for a Python expert who can try to fix my above Python error very quickly.
asked Jul 15 Raphael Pacheco 4.9k points
1 vote
1 answer 30 views
Problem: I tried to pass the kwargs as a dictionary so I wrote this code: class All(object): otp_wait = 25 def __init__(self, surname, birthdate, mobile_no, otp_host, **kwargs): kwargs.setdefault('browser', 'chrome') self.surname = surname self. ... otp_host, **input_kwargs) ^ SyntaxError: positional argument follows keyword argument Can anyone help me out to solve this thing. Thanks in advance.
asked Jun 7 samhaz 5k points