• 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,060 points

Please log in or register to answer this question.

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

Related questions

1 vote
1 answer 349 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
def choose_option(self): if self.option_picker.currentRow() == 0: description = open(":/description_files/program_description.txt","r") self.information_shower.setText(description.read()) elif self.option_picker.currentRow() == 1: requirements = open(":/description_files/ ... it as argument in open function, but when i am using it for loading of pictures and icons everything is fine.
asked Oct 24, 2020 psandprop 2.4k points
1 vote
1 answer 303 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, 2020 samhaz 5k points
0 votes
1 answer 15 views
Problem: I am learning Python. Recently I got an assignment in which I had to replace some characters of a string with other characters. While searching for the solution on the Internet, I came across the translate() method that can be used to do so. I tried the ... print(string.translate(string ,table)); I do not know why this problem occurs. Can anybody here help me sort out this error? Thanks!
asked Dec 27, 2020 Code Learner 5.3k points
0 votes
1 answer 9 views
Problem: OS: Windows 8 64bit with the latest update. Objective: Run Python.exe with Powershell as an administrator. I've changed the path to include the script but when I try to open Python I get an error code. I receive the same error during the installation.
asked Jan 8 Mashhoodch 5.6k points
0 votes
1 answer 15 views
Problem: I got this code: import numpy as np import pandas as pd dataset=pd.read_csv("/Users/rushirajparmar/Downloads/Social_network_Ads.csv",error_bad_lines = False) X = dataset.iloc[:,[2,3]].values. Y = dataset.iloc[:,4].values from sklearn.model_selection import ... but it didn't help y_pred = classifier.fit(X_test).values.ravel() TypeError: fit() missing 1 required positional argument: 'y'
asked Dec 24, 2020 sasha 5.3k points
0 votes
1 answer 92 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, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 41 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, 2020 samhaz 5k points
1 vote
1 answer 840 views
Problem : I am very new to Pytorch. I am currently trying to train my pytorch model I am using the unet model. I am getting dimension out of range error as shown below: /usr/local/lib/python3.5/dist-packages/torch/nn/functional.py in log_softmax(input, ... .view(-1) targets_flat = targets.view(-1) return self.crossEntropy_loss(probs_flat, targets_flat)` Please let me know how to fix above error.
asked Feb 20, 2020 mphil 2.3k points