top of page

Python: Variables

Variables are containers for any sets of data values the user inputs. Read more to learn the basics of variables and their examples.

In Python, To create a variable, assign a value and start. Assignment is done with a single equals sign (=)

​>>n=3;

>>print(n);

3

In Python, a variable may be assigned a value of one type and then later re-assigned a value of a different type:

>>> var = 30.5
>>> print(var)
30.5

>>> var = "Now I'm a string"
>>> print(var)
Now I'm a string

©2020 by Global Tech Nomads. 
Special thanks to X

bottom of page