Data Types in Python
Data Types in Python
The real life data is of many types. To represent this real life data in programming, interpreter/compiler uses some data types. The data types are classified on the basis of the structure of data.
Core Data Types in Python are:-
- Integer - Data in the format of integer comes under this.
- Floating Point - Numerical decimal data is known as float.
- Complex - Data in the form of Complex numbers.
- Boolean - True and False
- String - Text data is known as string in python.
- Tuple - A tuple is collection of python objects separated by comma. Tuples are represented by parentheses ().
- List - A list is a data type that can be used to store data in any format. The values in the list are called elements or items of the list. Lists are represented by square brackets [].
Difference between List and Tuple is that List is mutable i.e. value of the elements of the list can be changed while Tuple is immutable and it's content cannot be changed. - Array - It is a homogenous data structure which is used to store sequence of consecutive numbered objects. Each object in a array can be accessed from it's index.
- Dictionary - In this data is stored in the format of key value pair separated by colon (:). The content of dictionary can be accessed from the unique key.
Note :- Items of dictionary can be changed and thus it is mutable but the value of key cannot be changed and thus key is immutable.
Post a Comment
For any doubts feel free to ask in comments below.
Stay Connected to Us for more such Courses and Projects.