Positional Argument
noun
say it: “puh-ZISH-uh-nul AR-gyuh-ment” /pəˈzɪʃənəl ˈɑːrɡjəmənt/
A value passed to a function that is matched to a parameter by its position: the first value to the first parameter, the second to the second.
What is a positional argument?
A positional argument is matched to a parameter by its position: the first value goes to the first parameter, the second to the second, and so on.
def book_flight(origin, destination):
print(f"{origin} to {destination}")
book_flight("Denver", "Chicago") # Denver to Chicago
In a sentence
- “In book_flight("Denver", "Chicago"), both cities are positional arguments.”
- “Swapping the positional arguments sent Sam's flight from Chicago to Denver instead.”
Level: Apprentice · More Python terms at this level
Updated