Data Types. Chapter 2: Python Variables,Strings & Data Types. Python Variables
● Variables are nothing but memory locations used to store
values. ● Creating a Variable will reserve some space in memory. ● A Variable in Python is created by just assigning a value to it. Example : Declaring Variables and Printing them. Python Data Types
● Variables can store different data types.
● Python has the following data types by default: ○ Text Type : str ○ Numeric Types : int , float , complex ○ Sequence Types : list , tuple , range ○ Mapping Type : dict Python Data Types
○ Set Types : set , fronzenset
○ Boolean Type : bool ○ Binary Types : bytes , bytearray , memoryview How to find the Data Type of a Variable
● In order to get the Data Type of a Variable, we can use
type() function. Declare and Print String Data type Variable
● To Print String Data Types, we can either use single quotes
or double quotes: Examples : String, Integer, Float and Complex Python Type Casting ● A Variable can be converted from one data type to another data type. ● This is done by Type Casting in Python. ● Type Casting is done in Python using Constructor Functions. Thank You