Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

takes 2 positional arguments but 3 were given

# just put self in other functions like this
class myclass:
  def __init__(self, parameter):
  	self.parameter = parameter
  def function(self, otherparameter):
    # put a self ^ there
    print(self.parameter + otherparameter)

object=myclass(1)
object.function(2)
# output is 3
 
PREVIOUS NEXT
Tagged: #takes #positional #arguments
ADD COMMENT
Topic
Name
3+3 =