Python - Passing argument by position

Introduction

Python matches names by position from left to right.

For instance, if you define a function that requires three arguments, you must call it with three arguments:

Demo

def f(a, b, c): print(a, b, c) 
print( f(1, 2, 3) )

Result

Here, we pass by position-a is matched to 1, b is matched to 2, and so on.

Related Topic