Intellipaat

Intellipaat

Explore Online Courses Free Courses Hire from us Become an Instructor Reviews
All Courses
  • Articles
  • Tutorials
  • Interview Questions
Home > Blog > Tutorials > Python Tutorial For Beginners > Python Data Types

Python Data Types

By Lithin Reddy | Last updated on November 11, 2025 | 87548 Views
Share this article
Previous
Next
Tutorial Playlist
  • Python Tutorials

    • Python Tutorial For Beginners
    • Introduction and History of Python
    • Python Download – How To Install Python [Easy Steps]
    • Python Version History
    • What is Python Programming Language?
    • Advantages and Disadvantages of Python
    • Python Data Types
    • Python Arrays – The Complete Guide
    • Strings in Python
    • Python Numbers – Learn How to Create Prime Numbers, Perfect Numbers, and Reverse Numbers in Python
    • Python Classes and Objects
    • Python for Loops – A Step-by-Step Guide
    • Python If Else Statements – Conditional Statements with Examples
    • Python Syntax: A Guide To Writing Basic Python Code
    • Python JSON – Parsing, Creating, and Working with JSON Data
    • File Handling in Python
    • Introduction to Python Modules
    • Python Operators
    • Enumerate() in Python – A Detailed Explanation
    • Python Set – The Basics
    • Python Datetime – A Guide to Work With Dates and Times in Python
    • Python Lists – A Complete Guide (With Syntax and Examples)
    • How to Install Pip in Python
    • What are comments in python
    • Tokens in Python – Definition, Types, and More
    • How to Take List Input in Python – Python List Input
    • Tuples in Python
    • Python Function – Example & Syntax
    • What is Regular Expression in Python
    • Python Modules, Regular Expressions & Python Frameworks
    • How to Sort a List in Python Without Using Sort Function
    • How to Compare Two Strings in Python?
    • What is Type Casting in Python with Examples?
    • List vs Tuple in Python
    • Identifiers in Python
    • A Complete Guide to Data Visualization in Python
    • What is Recursion in Python?
    • Python Lambda Functions – A Beginner’s Guide
    • List Comprehension in Python
    • Python Built-in Functions
    • Dictionaries in Python – From Key-Value Pairs to Advanced Methods
    • Python Input and Output Commands
    • Web Scraping with Python – A Step-by-Step Tutorial
    • Exception Handling in Python with Examples
    • Numpy – Features, Installation and Examples
    • Python Pandas – Features and Use Cases (With Examples)
    • SciPy in Python Tutorial
    • Introduction to Matplotlib in Python
    • Scikit-Learn Cheat Sheet: Python Machine Learning
  • Python Tutorials

    • Python Tutorial For Beginners
    • Introduction and History of Python
    • Python Download – How To Install Python [Easy Steps]
    • Python Version History
    • What is Python Programming Language?
    • Advantages and Disadvantages of Python
    • Python Data Types
    • Python Arrays – The Complete Guide
    • Strings in Python
    • Python Numbers – Learn How to Create Prime Numbers, Perfect Numbers, and Reverse Numbers in Python
    • Python Classes and Objects
    • Python for Loops – A Step-by-Step Guide
    • Python If Else Statements – Conditional Statements with Examples
    • Python Syntax: A Guide To Writing Basic Python Code
    • Python JSON – Parsing, Creating, and Working with JSON Data
    • File Handling in Python
    • Introduction to Python Modules
    • Python Operators
    • Enumerate() in Python – A Detailed Explanation
    • Python Set – The Basics
    • Python Datetime – A Guide to Work With Dates and Times in Python
    • Python Lists – A Complete Guide (With Syntax and Examples)
    • How to Install Pip in Python
    • What are comments in python
    • Tokens in Python – Definition, Types, and More
    • How to Take List Input in Python – Python List Input
    • Tuples in Python
    • Python Function – Example & Syntax
    • What is Regular Expression in Python
    • Python Modules, Regular Expressions & Python Frameworks
    • How to Sort a List in Python Without Using Sort Function
    • How to Compare Two Strings in Python?
    • What is Type Casting in Python with Examples?
    • List vs Tuple in Python
    • Identifiers in Python
    • A Complete Guide to Data Visualization in Python
    • What is Recursion in Python?
    • Python Lambda Functions – A Beginner’s Guide
    • List Comprehension in Python
    • Python Built-in Functions
    • Dictionaries in Python – From Key-Value Pairs to Advanced Methods
    • Python Input and Output Commands
    • Web Scraping with Python – A Step-by-Step Tutorial
    • Exception Handling in Python with Examples
    • Numpy – Features, Installation and Examples
    • Python Pandas – Features and Use Cases (With Examples)
    • SciPy in Python Tutorial
    • Introduction to Matplotlib in Python
    • Scikit-Learn Cheat Sheet: Python Machine Learning
`; ip_get_section_iq.innerHTML = sidebarhtml_desk; playlistmobile.innerHTML = sidebarhtml_desk; var ip_iq_scriptToRemove = document.getElementById('ip-blog-iq-script-removal'); if (ip_iq_scriptToRemove) { ip_iq_scriptToRemove.remove(); } var activeSubmenuItems = document.querySelectorAll('.tutorial_list_submenu li.active'); activeSubmenuItems.forEach(function(activeItem) { var rootParentLi = activeItem.closest('.maincata'); if (rootParentLi) { rootParentLi.classList.add('opentutorialsubmenu'); } }); var ip_blog_tutorialListMenu = document.querySelector('.tutorial_list_menu'); if(ip_blog_tutorialListMenu){ var ip_blo_activeItem = ip_blog_tutorialListMenu.querySelector('li.active'); var lastlink = ''; var nextlink = ''; var total = 0; jQuery('#TutorialLeftArea .maincata ul').children('li').each(function(indexx) { total = indexx; }); jQuery('#TutorialLeftArea .maincata ul').children('li').each(function(i) { var isActive = jQuery(this).hasClass('active'); if(isActive){ if(i !== 0){ var lastIndexedElement = jQuery('#TutorialLeftArea .maincata ul').children('li').eq(i - 1); lastlink = lastIndexedElement.children('a').attr('href'); }else{ lastlink = ''; } if(total > i){ var nextIndexedElement = jQuery('#TutorialLeftArea .maincata ul').children('li').eq(i + 1); nextlink = nextIndexedElement.children('a').attr('href'); }else{ nextlink = ''; } return false; } }); var ip_blog_prevBlog = document.querySelector('.prev-blog a'); var ip_blog_nextBlog = document.querySelector('.next-blog a'); if (lastlink !== '' && typeof lastlink !== 'undefined') { ip_blog_prevBlog.setAttribute('href', lastlink); }else { if(ip_blog_prevBlog){ ip_blog_prevBlog.style.display = 'none'; } } if (nextlink !== '' && typeof nextlink !== 'undefined') { ip_blog_nextBlog.setAttribute('href', nextlink); }else { if(ip_blog_nextBlog){ ip_blog_nextBlog.style.display = 'none'; } } } function ip_blog_setActiveLink() { var divElements = document.querySelectorAll('div[id]'); var links = document.querySelectorAll('.interview-question-bookmark-list-alt li a'); var activeLink = null; divElements.forEach(function(div) { if (ip_blog_isInViewportThreshold(div, 50)) { var ip_blog_divId = div.getAttribute('id'); links.forEach(function(link) { if (link.getAttribute('href') === '#' + ip_blog_divId) { activeLink = link; } }); } }); links.forEach(function(link) { link.classList.remove('active'); }); if (activeLink) { activeLink.classList.add('active'); } } function ip_blog_isInViewportThreshold(element, threshold) { var rect = element.getBoundingClientRect(); var windowHeight = window.innerHeight || document.documentElement.clientHeight; var topThreshold = rect.top - threshold; var bottomThreshold = rect.bottom + threshold; return topThreshold <= windowHeight && bottomThreshold >= 0; } window.addEventListener('scroll', ip_blog_setActiveLink); window.addEventListener('load', ip_blog_setActiveLink); }); function ip_blg_findClosestAnchor(element) { while (element) { if (element.tagName === 'A') { return element; } element = element.parentNode; } return null; } function ip_bl_v_scrollToDiv(event_pb, offset) { event_pb.preventDefault(); const ip_bl_linkElement = ip_blg_findClosestAnchor(event_pb.target); if (ip_bl_linkElement) { const it_bl_hashValue = ip_bl_linkElement.getAttribute('href').substring(1); const it_blg_vf_targetElement = document.getElementById(it_bl_hashValue); if (it_blg_vf_targetElement) { jQuery('html, body').animate({ scrollTop: jQuery('#' + it_bl_hashValue).offset().top - offset }, 1000); } } } document.addEventListener('DOMContentLoaded', function() { let it_bl_offset = 0; const ip_blo_vi_anchorLinks = document.querySelectorAll('a[href^="#"]'); ip_blo_vi_anchorLinks.forEach(function(linkip_bg) { linkip_bg.addEventListener('click', function(event_pb) { setTimeout(function() { console.log('Offset passed during click: ' + it_bl_offset); ip_bl_v_scrollToDiv(event_pb, it_bl_offset); }, 0); }); }); });

Understanding the data types in Python is essential for writing efficient programs. Data types determine the type of value a variable can store, including a number, text, or lists. They help organize and process data effectively. They also ensure that the operations are performed correctly. In this article, we’ll explore various Python Data Types with Examples of how to use them effectively.

Python Data Types

Table of Contents:

  • What are Python Data Types?
  • Numeric Data Types in Python
  • Sequence Data Types in Python
  • Python Dictionary Data Type
  • Python Set Data Type
  • Boolean Data Type in Python
  • None Data Type in Python
  • Complex Data Types in Python
  • Mutable vs Immutable Data Type in Python
  • Using isinstance() to Check Data Types in Python
  • Type Conversion in Python
  • Python Data Type Exercise Questions

What are Python Data Types?

In Python, data types define a variable’s value, including numbers, strings, or sets. The most commonly used data types are integers(int), floating point numbers(float), string(str), list(list), and dictionary(dict). Python is known for its simplicity and powerful functionality. One of the important features of data type is dynamic typing, which allows variables to change their data type as needed. This flexibility makes Python highly versatile and easy to work with.

Data Type Class Value
Numeric Int, float, complex Numeric value
String str Sequence of characters
Sequence List, tuple, range Collection of items
Mapping dict Data in key-value pair form
Set Set, frozen set Unordered, unique collection
Boolean bool Boolean value “True” or “False”

Numeric Data Types in Python

Numeric data types in Python can hold numeric values such as integers, decimal numbers(floating numbers), and complex numbers.

  • Integer: Integers are represented by the int class. It can contain positive and negative values. The size of an integer is not limited by a fixed maximum it can grow as long as memory permits
  • Floating point: Floating point variables are represented by the float class. It can only hold decimal values.
  • Complex Numbers: Complex numbers are represented by complex classes.
    Data Type Class Example
    Integer int x = 10
    Floating Point float y = 10.5
    Complex Number complex z = 5 + 6j

Example:

Python
Code Copied!

Output:Numeric Data Types in Python

Sequence Data Types in Python

Sequence data types in Python are capable of representing ordered collections of items. They are iterable, support indexing and slicing, and provide multiple manipulation methods.  These are the following sequence data types in Python:

  • String
  • List
  • Tuple
Data Type Class Example
String str str_example = “Hello, World!”
List list list_example = [1, 2, 3, “Python”]
Tuple tuple tuple_example = (10, 20, “AI”)
Unlock Python’s Power!
Enroll today and begin your journey to becoming a Python pro!
Explore Program
quiz-icon

1. Python String Data Type

Python strings are a combination of letters or characters enclosed in single quotes or double quotes. In Python, there is no character data type. Here, character is also included in the string class. A string of length 1 can be called a character string. We can access individual characters with the help of an index. The str class represents it.

  • Creation of String in Python:
    In Python, a string can be created by placing characters or letters within either single quotes (‘ ‘) or double quotes (” “).

Example:

Python
Code Copied!

Output:Creation of String in Python
  • Accessing Strings in Python

Individual characters within a string can be accessed using an index. Python uses zero-based indexing, meaning the first character is at index 0. Negative indexing can also be used to access the characters from the end of the string.

Example:

Python
Code Copied!

Output:Accessing Strings in Python

2. Python List Data Types

Lists in Python are created using a square bracket [ ]. They can hold various data types, such as numbers, text, or even other lists. Each entry within a list is separated by a comma. Lists allow you to combine multiple items into one collection and give easy access and modification as required.

  • Creating a List in Python

Python
Code Copied!

Output:Python List Data Types
  • Access List Items in Python

We can access the list of items with the help of the index. In Python, negative indices are used for reverse traversal, like: a[-1] represents the first element from the end, a[-2] represents the second element from the end.

Example:

Python
Code Copied!

Output:Access List Items in Python

3. Python Tuple Data Type

Tuple data types are also the same as list data types in Python. The only difference between them is that tuples are immutable, which means we can not change the tuple elements after they are created. Tuples are defined using parentheses.

  • Creating a Tuple in Python

In Python, tuples are created using parentheses with different types of values separated by commas.

Example:

Python
Code Copied!

Output:Creating a Tuple in Python
  • Access Tuple Items in Python

We can access tuple elements with the help of an index. With the help of the index and subscript operators, we can access the tuple elements easily.

Start Your Python Adventure!
Join now and start coding your future with Python!
Explore Program
quiz-icon

Example:

Python
Code Copied!

Output:Access Tuple Items in Python

4. Python Range Data Type

In Python, range() is a sequence data type that gives an output for any series of numbers within a specified range. The range() becomes more efficient with the help of a loop.

Example:

Python
Code Copied!

Output:Python Range Data Type

Python Set Data Type

A set in Python is an unsorted (unordered) collection of elements that contains unique elements. They are unordered and do not allow duplicates. Sets are defined using curly brackets.

  • Creating a Set in Python

A set is created in Python with the set() function and an iterable object or list of objects separated by commas. Sets can also contain different types of data.

Example:

Python
Code Copied!

Output:Creating a Set in Python
  • Access Set Items

Set Items cannot be accessed with an index, we have to use a loop to iterate through the set items.

Example:

Python
Code Copied!

Output:Access Set Items

Python Dictionary Data Type

The dictionary in Python uses data types to store elements in key-value pairs like maps. An unordered collection of data values is stored in the dictionary in the form of key-value pairs. In the key-value pair format, the key values are separated from each other by a colon.

  • Create a Dictionary in Python

In Python, a dictionary can be built using the built-in function dict(). Any object can be used to take the values provided in the dictionary. Duplicates are allowed in a dictionary, but the keys must be unique. The keys of the dictionary are case-sensitive.

Example:

Python
Code Copied!

Output:Create a Dictionary in Python
  • Access Dictionary Values Using Keys in Python

The values in the dictionary can be accessed using their keys. The built-in function get() can be used to access the values.

Example:

Python
Code Copied!

Output:Access Dictionary Values Using Keys in Python

Boolean Data Type in Python

Python also provides one built-in data type, Boolean, that gives us two values, True and False. It can take the value of either True or False and is implemented by the class bool. The true expressions will be returned as True by Python, while expressions that are not true will be returned as False.

Example:

Python
Code Copied!

Output:Boolean Data Type in Python

None Data Type in Python

None is a data type that represents null, which is commonly used to indicate that a variable does not contain a value.

Example:

Python
Code Copied!

None Data Type in Python

Complex Data Types in Python

Complex data types can be defined as a combination of integers, strings, lists, and dictionaries joined together.

Python allows you to build more structured data using nested data structures such as a list inside a dictionary or a dictionary inside another dictionary. These complex types help store and manage information efficiently in Python.

Example: Storing Information in a Nested Dictionary

Python
Code Copied!

Output:Complex Data Types in Python

Mutable vs Immutable Data Types in Python

Feature Mutable Data Type Immutable Data Type
Definition Can be changed even after the creation Cannot be changed once created
Data Types Lists, Dictionaries, Sets Strings, Tuples, Numbers
Memory Usage Can change memory location if resized Stays in the same memory location even after resizing
Modification Supports add, remove, and update Need to create a new object to make the changes
Performance Slightly slower due to modification Faster as data remains constant
Methods Available Methods like append(), remove() modify the data Methods like replace() return a new object
Example intellipaat_list = [1, 2, 3]
intellipaat_list.append(4)
print(intellipaat_list)
# Output: [1, 2, 3, 4]
intellipaat_tuple = (1, 2, 3)
intellipaat_tuple[0] = 5
# Output: TypeError: ‘tuple’ object does not support item assignment

Using isinstance() to Check Data Types in Python

The isinstance() function verifies a specific type of variable. Types in Python int, float, str, list, and tuple, are supported. Sometimes it is necessary to check what type the variable it is before you go further in your Python program. The isinstance() method checks whether an object is an instance of a specified class or type, helping the programmer avoid errors in the code.

Example: Checking Data Types with isinstance()

Python
Code Copied!

Output:Using isinstance() to Check Data Types in Python

Type Conversion in Python

Type conversion in Python is used to change a variable from one data type into another.

If you want to do some operations on specific types of data, you may need to convert data from one type to another to perform specific operations. Python makes type conversion simple and easy to accomplish by providing built-in functions like int(), float(), str(), list(), tuple(), and much more. Type conversion makes data types accessible to each other in your Python program.

Example: Converting Different Data Types

Python
Code Copied!

Output:Type Conversion in Python

Why Check Data Types in Python?

  • Ensures Correct Operations: Certain operations require a specific type of data to be used.
  • Prevents Errors: Knowing the data type helps avoid type mismatch errors during the execution of the program.
  • Debugging: Checking the data type makes it easier to trace errors when your program gives unexpected output.
  • Improves Code Readability: Knowing the type of data gives an idea about the purpose of the variable.
  • Optimizes Performance: A proper check of the data type makes it possible for the program to execute with ease and efficiency, without producing unnecessary errors.

Python Data Type Exercise Questions

Here are some of the practice questions on Data Types in Python that you should prefer for revising the concept learned in this article.

1. Implement Basic Dictionary Operations in Python

Python
Code Copied!

Output:Implement Basic Dictionary Operations in Python

2. Implement Basic List Operations in Python

Python
Code Copied!

Output:Implement Basic Dictionary Operations in Python

3. Implement Basic Set Operations in Python

Python
Code Copied!

Output:Implement Basic Set Operations in Python

4. Implement Basic Tuple Operations in Python

Python
Code Copied!

Output:Implement Basic Tuple Operations in Python

5. Implement Basic String Operations in Python

Python
Code Copied!

Output:Implement Basic String Operations in Python

Conclusion

Python offers a wide range of data types such as int, float, string, list, and tuple. Each serves a unique purpose in your code. Understanding Python data types and dynamic typing is key to writing efficient, clean, and optimized programs. With its simple syntax and flexible features, Python is ideal for both beginners and experienced programmers.
Explore more Python programming tutorials to boost your coding skills and master data structures. Enroll Today! with Intellipaat’s Python Programming Course.  Also, prepare for job interviews with our Python developer interview questions, prepared by industry experts.

About the Author

Lithin Reddy
Lithin Reddy
Data Scientist | Technical Research Analyst - Analytics & Business Intelligence

Lithin Reddy is a Data Scientist and Technical Research Analyst with around 1.5 years of experience, specializing in Python, SQL, system design, and Power BI. Known for building robust, well-structured solutions and contributing clear, practical insights that address real-world development challenges.

Recommended Videos
Python Interview Questions And Answers
Python Interview Questions And Answers
Numpy Interview Questions For Freshers
Numpy Interview Questions For Freshers
Pandas Coding Interview Questions
Pandas Coding Interview Questions
OOPS Interview Questions and Answers
OOPS Interview Questions and Answers
Python Pandas Tutorial
Python Pandas Tutorial
Recommended Programs
Python Course
Python Course
5 (218118)
Free Python Certification Course Online
Free Python Certification Course Online
5 (53455)
Python Data Science Course
Python Data Science Course
5 (76533)
Software Development Engineering Course
Software Development Engineering Course
5 (23421)

Course Preview

Expert-Led No.1

Python Data Types

Intellipaat

facebook twitter linkedin youtube insta telegram

Intellipaat

facebook twitter linkedin youtube insta telegram

Get Our App Now!

Intellipaat android app Intellipaat android app

Get Our App Now!

Intellipaat android app Intellipaat android app

Courses

  • Data Scientist Course
  • Machine Learning Course
  • Python Course
  • Devops Training
  • Business Analyst Certification
  • Cyber Security Courses
  • Business Analytics Training
  • Investment Banking Course
  • SQL Course
  • AWS DevOps Course
  • Full Stack Developer Course
  • Product Management Course

Courses

  • AWS Solutions Architect
  • UI UX Design Course
  • Salesforce Training
  • Selenium Training
  • Artificial Intelligence Course
  • Ethical Hacking Course
  • Azure Administrator Certification
  • Cyber Security Course
  • Digital Marketing Course
  • Electric Vehicle Course
  • Azure DevOps Course
  • Web Development Courses

Tutorials

  • Python Tutorial
  • AWS Tutorial
  • Devops Tutorial
  • Java Tutorial
  • Node Js Tutorial
  • Cyber Security Tutorial
  • Salesforce Tutorial
  • Azure Tutorial
  • Ethical Hacking Tutorial
  • Data Science Tutorial
  • Cloud Computing Courses
  • Python Data Science Course

Interview Questions

  • Python Interview Questions
  • AWS Interview Questions
  • Data Science Interview Questions
  • Devops Interview Questions
  • Salesforce Interview Questions
  • Java Interview Questions
  • SQL Interview Questions
  • React Interview Questions
  • Node Js Interview Questions
  • Digital Marketing Interview Questions

Browse By Domains

Data Science Salesforce Courses Cloud Computing Courses AI & Machine Learning Courses Project Management Courses Cyber Security and Ethical Hacking Courses Web Development Courses Job Oriented Courses Degree Courses Marketing CRM Courses Software Development Courses Doctorate Programs Undergraduate Courses Banking and Finance Courses Product Design Courses Electric and Hybrid Vehicle Courses Leadership & Management Courses Management Courses Generative AI Courses Design Thinking Courses Microsoft Certification Courses

Top Tutorials

Machine Learning Tutorial Power BI Tutorial SQL Tutorial Artificial Intelligence Tutorial Digital Marketing Tutorial Data Analytics Tutorial UI/UX Tutorial

Top Articles

Cloud Computing Data Science Machine Learning What is AWS Digital Marketing Cyber Security Salesforce Artificial Intelligence

Top Interview Questions

Selenium Interview Questions Azure Interview Questions Machine Learning Interview Questions Cyber Security Interview Questions Business Analyst Interview Questions and Answers C Interview Questions Data Analyst Interview Questions Software Engineering Interview Questions

© Copyright 2011 - 2026 Intellipaat Software Solutions Pvt. Ltd.
Media
Contact Us
Tutorials
Interview Questions

Address: 6th Floor, Primeco Towers, Arekere Gate Junction, Bannerghatta Main Road, Bengaluru, Karnataka 560076, India.

Disclaimer: The certification names are the trademarks of their respective owners.

INTPL_2026-04-14