Připojit() trvá 2 poziční argumenty, ale 3 byly uvedeny

Příklady kódu

1
0

2 poziční argumenty, ale 3 byly uvedeny

#Positional arguments are the amount of arguments passed through a function
#For example

def function(value1, value2):
	print(value1)
	print(value2)

function("value1","value2","value3")
0
0

trvá 2 poziční argumenty, ale 3 byly uvedeny

# 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

Související stránky

Související stránky s příklady

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................