Basics

Module 2 · Basics · Lesson 7 of 9

Positional arguments

When you give print several arguments, how does it know which comes first? By their position. These are called positional arguments: the first value you write is used first, the second is used second, and so on.

Order is everything
print("Alice", "Bob")
Alice Bob
print("Bob", "Alice")
Bob Alice

Same two values — swap their positions and the output swaps too.

It sounds obvious for print — they just come out in the order you wrote them — but it's a rule that runs through all of Python. A function decides what each slot means, and the position of your value decides which slot it fills.

So print("Alice", "Bob") and print("Bob", "Alice") are different instructions with different output. Order carries meaning. But position isn't the only way to pass an argument — some have names, which is next.