How Can We Help?
< All Topics

Python Variables

What is a Variable?

In computer programming, a variable is used to store information in a keyword that can be referenced and manipulated later in the program. Variables also allow the user to give a piece of data a descriptive name that describes what information it stores.


Creating Variables in Python

To create a simple variable, type the variable name, the equals (`=`) sign, and the variable value. For example:

Here a is a variable, and its value is set to 1. You can print the variable name to show its value, or type the variable name in the last line of the cell to see the value.

Variable names must begin with an alphabetic character (az), a digit (09), or underscore (_). Variable names are case-sensitive!

Previous Python as a Calculator
Next Python Types
Table of Contents