Code Learning#PYTHON#8171
Back
understanding value types
Python allows automatic typing of values based on the value provided. Automatic typing means that as soon as value is given to a variable its type is defined. For e.g. if x=10 is given x automatically becomes a label of memory location which contains an integer.
Source Code
Run Output
Notes
- Values are automatically typed to integer, float (containing part after decimal sign) or string.
- There are more types such as boolean, complex etc. That we shall learn later.
- In python even the type list, set etc are value types and are auto types, We will see them in forthcoming chapters.
- Dynamic type provisioning is a fundamental concept in python, however new version from 3.5 provide type hints to let a person understand which type is being used.
