Lesson 4 of 19 · 2 min
Parameters vs Arguments
Parameter = the placeholder variable name in the definition
Argument = the actual value you supply when calling
def greet(name): # 'name' is the PARAMETER — a placeholder
print(f"Hello, {name}!") # f-string uses whatever value 'name' holds
greet("Priya") # "Priya" is the ARGUMENT — the real value passed in
greet("Ahmed") # name = "Ahmed" during this call
greet("World") # name = "World" during this call
Output: Hello, Priya! Hello, Ahmed! Hello, World!
Multiple Parameters
def calculate_area(length, width): # two parameters
area = length * width # multiply them
print(f"Area = {area} square metres") # show the result
calculate_area(5, 3) # length=5, width=3 — positional: ORDER matters!
calculate_area(10, 4) # length=10, width=4
calculate_area(7, 7) # both the same — a square
Output: Area = 15 square metres Area = 40 square metres Area = 49 square metres
