Is it possible to define a function with more than one set amount of parameters in Python? -


this question has answer here:

i define function takes 2 arguments, possibility of third. i'm isn't possible, considering built-in range function has:

range(stop) -> range object range(start, stop[, step]) -> range object 

maybe it's possible? or maybe have wrong idea because range immutable sequence type?

for clarity's sake, same function example(x,y) run example(x,y,z)

def example(x, y, z=none):     if z none:         return x + y     else:         return x + y + z 

then

>>> example(3, 4) 7  >>> example(3, 4, 5) 12 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -