1
Imagine you are at the market in Yaba or Onitsha, and you buy some items. You put your tomatoes in one bag, your pepper in another bag, and your fish in a third bag. Each bag holds something specific, and you can label each bag so you remember what is inside.
In programming, a variable is exactly like one of those bags. It is a container that holds information. You give the container a name (a label), and you put data inside it.
Here is a simple example:
age = 16
name = "Chioma"
height = 1.65
In these three lines:
age is a variable that holds the number 16
name is a variable that holds the text "Chioma"
height is a variable that holds the number 1.65 (representing meters)
The equals sign ( = ) does not mean "equals" in the mathematical sense. In Python, it means "assign" or "store." You are saying: "Create a container called age and store the value 16 in it."
Log in to add a comment.