top of page

Data Types in Python Programming Language

Data Types in Programming is a method of organizing information such that the program could use the data effectively. Common Data types include Text Type (String), Numerical Type (Integer, Float, Double) Boolean Type (True or False), and many more.


In this article, we explain some basic, built-in data types in Python Language with the purpose of storing a collection of data. Those data types are List, Tuples, Sets, and Dictionaries.





The list is the data type that enables the program to store multiple items in a single variable. The items within list are in defined order with distinct index for each item thus latest item will be placed at the end of the list.


The programmer could change, add, and remove items and list also allows duplicate values. In Python, List are created using square brackets and usually applied for storing data with same type.


A tuple is a data type similar to lists with one main difference: tuples are immutable. This means that the items within tuples are unchangeable and usually used for storing items with multiple item types. Tuples are created using round brackets.


Sets are an unordered, immutable data type with unique elements. Set items appear in a different order in every use and programmers could only add new items to Set. An example operation of Set includes member testing and eliminating duplicate entries. Sets are created using a set() function or curly brackets.


Dictionaries are unique data types, where each value within the data has one key pair (key: value pairs format). Values in the dictionaries are mutable whereas keys are unique immutable string or numeric data type. If List uses indexes for accessing items, dictionaries use key variables instead.


This article briefly explains the definition and main features of the data types. Apart from these data types, Python also provides built-in functions for manipulating the data type and their items within. To fully understand the relationships between data type and the functions, we suggest practicing coding and learn more about the functions from Python Documentations (docs.python.org).

1 view0 comments

Comments


bottom of page