# Assigning Values to Variables in Python

PythonServer Side ProgrammingProgramming

Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables.

## Example

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 −

Live Demo

#!/usr/bin/python
counter = 100 # An integer assignment
miles = 1000.0 # A floating point
name = "John" # A string
print counter
print miles
print name

Here, 100, 1000.0 and "John" are the values assigned to counter, miles, and name variables, respectively.

## Output

This produces the following result −

100
1000.0
John
Published on 24-Jan-2020 11:24:46