Skip to content

What is the difference between a variable and a parameter

I am learning python 3 and programming in general for the first time, but I can’t seem to distinguish a parameter and a variable?


A variable is just something that refers/points to some data you have.

x = 5

Here x is a variable. Variables can point to more kinds of data than just numbers, though. They can point to strings, functions, etc.

A parameter is something that is passed into a function

def my_function(y):

Here y is a parameter. It doesn’t contain a value yet. But if I want to call the function, I need to provide an argument to the function.

An argument is the actual value you provide to the function that replaces the parameter.


Here, 5 is the argument. Of course, since x points to the value “5”, I can do this too:


which also prints 5