Previous | Next


A variable is basically a name that represents or refers to some value. Assigning a variable in Python is simple. For example, you might want the name w to represent 8. To make it so, simply execute the following:

>>> w = 8

To make x to represent a float:

>>> x = 12.50

To make y to represent a string:

>>> y = 'my new string'

To make z to represent a boolean:

>>> z = True

 


Previous | Next