Variables
Introduction
In Math class, you learned that a variable is a symbol for a number that you don't know yet. In Computer Science, a variable is information that is stored in a program.
Variables in Python
A variable name refers to a particular object.
A variable is a location in memory where a programmer can store a value.
Variables are created when first assigned.
The type of the variable is determined by Python automatically.
A Variable is data that can change.
Python Data Types
Variable names can be any length. However, stick to variable names that are short, sweet and to the point. Good variable names in Python will make your code easy to read and understand.
Variable Name Rules
Variable names are case sensitive.
Assigning a value to a Variable
To assign a value to a variable, use the = sign.
Variable Roles
Variables have typical uses that are called variable roles. Variable roles are not the same as types of variables (integer, float, string, boolean, etc.) since the concept of roles is a classification telling what kind of a task a variable has in a certain program.
Last updated