Coding in Python takes time and deliberate effort. In this series, we simplify coding concepts and teach coding through simple examples that are easy to digest and remember. This week we will teach you how to create variables.
Variables are reserved memory locations that store values. When you create a variable in your program, you essentially create a tag for a group of bytes in memory. The group of bytes can be anywhere in memory. Its location is unimportant for coding.
Variables make your programs useful and dynamic. For example – when you’re shopping – the software at the counter (point of sale) will scan all items, and keeps track of prices and quantities of items. The software program then calculates the total cost of all items you purchased.
Three simple rules for creating a variable in Python:
Variable names can have numbers, text, or characters like underscore _
Variables cannot start with a number, and cannot contain a space
“=” sign is used to assign a variable