Lesson Progress
0% Complete
Variables
A variable is a store of value. The equal sign = is used to assign values to variables. The operand to the left of the = operator is the name of the variable and the operand to the right of the = operator is the value stored in the variable. For example:
name = "Jane Doe" # a string age = 30 # an integer variable height = 5.5 # a float point variabe print name print age print height
Here the value name is assigned to the variable name, 30 assigned to variable age and 100.50 assigned to height. The output of the above is:
John Doe 30 5.5
Data Types
The data stored in memory can be of many types. Python has 5 standard data types that define the operations possible and storage; They include:
- Numbers – data store for numeric values
- Strings – set of characters inside double or single quotes
- List
- Tuples
- Dictionary
We will look at each in-depth in the next chapters