Variables are named locations in memory used to store data. In this example we show how to create one, update it to a new value and then print it.
Unlike many programming languages, Python does not require us to specify the data type of a variable when we create it. However there are circumstances when we need to have all variables in the same type for example when printing. To cast between datatypes we can use the following commands:
- Convert x from anything to a string = str(x)
- Convert x from anything to a int = int(x)
- Convert x from anything to a float = float(x)
Read more about standard variable types https://docs.python.org/2/library/stdtypes.html