• Offers
    • RegisterLogin
      • Learn More
    PythonPoint.netPythonPoint.net
    • Offers
    • RegisterLogin
      • Learn More

      Python

      SKILL IS IMPORTANT THAN DEGREE Be skill full.
      • Home
      • Blog
      • Python
      • What is Data Structure in Python

      What is Data Structure in Python

      • Posted by Python Point Team
      • Categories Python
      • Date January 10, 2021
      • Comments 0 comment
      what is data structure in python

      Data Structure is a representation that shows relationships between data items. They can be used for storing the data, organizing data, and also defines the operations that can be performed on the data.

      List, Dictionary, Tuple, Sets are the built-in data structures available in Python. Data structures like Stack, Queue, Linked lists, Graphs and Trees can be implemented using the built-in data structures.

      List – A sequential data structure used to store different data types. A list is written inside square brackets. In a list, the index starts from 0. Python provides various built-in List methods. This includes len(), append(), insert(), pop() and many more.

      >>> li = [1, 2, 4, 'abc', 'xzy']
      >>> type(li)
      <class 'list'>

      Dictionary – Used to store data as Key-Value pairs. A dictionary is an unordered collection. They don’t allow duplicates. Dictionaries are written inside curly brackets with full colon separating key and value.

      >>> di = {1:10, 2:'apple', 'color':'red'}
      >>> type(di)
      <class 'dict'>
      

      Tuple – A tuple is similar to list, but the former is immutable while the latter is mutable. This means that once a tuple is created its elements cannot be changed at a different point in time. A tuple is written inside round brackets with comma separating the elements.

      >>> tp = (1, 4, 2, 'red')
      >>> type(tp)
      <class 'tuple'>
      

      Set – Unordered collection of unique elements. This is similar to sets in mathematics. Sets are written inside curly brackets with comma separating elements.

      >>> a= {1, 2, 1}
      >>> a
      {1, 2}
      >>> type(a)
      <class 'set'>
      
      • Share:
      author avatar
      Python Point Team

      Previous post

      How to Insert Data into Table using Python and MySQL
      January 10, 2021

      Next post

      How to create table in Python
      January 10, 2021

      You may also like

      15 Powerful Step for Mastering JSON Parsing in Python: Boosting Data Manipulation and Validation
      21 June, 2023

      Introduction In the world of programming, data plays a crucial role, and managing it efficiently is of utmost importance. JSON (JavaScript Object Notation) has emerged as a popular data interchange format due to its simplicity and flexibility. In this article, …

      Introduction to Transfer Learning with Python: A Practical Guide
      31 December, 2022

      Introduction: Definition of transfer learning Overview of how transfer learning works in the context of machine learning Why transfer learning is useful and important Section 1: Transfer learning in Python with Keras In this section, we will explore how to …

      How to Check Type in Python
      31 December, 2022

      In this article, we will learn to check type in Python. The built-in function type() can be used to check the type of data in Python.

      Subscribe
      Login
      Notify of
      Please login to comment
      0 Discussion
      Inline Feedbacks
      View all comments

      Latest Courses

      (Hindi) Ways to earn minimum 1 Lakh Per month as Programmer

      (Hindi) Ways to earn minimum 1 Lakh Per month as Programmer

      ₹10,000
      (HINDI) Full Stack Web Development In Python 3.8 And Django 3.1

      (HINDI) Full Stack Web Development In Python 3.8 And Django 3.1

      ₹25,000 ₹2,500

      Latest Posts

      • 15 Powerful Step for Mastering JSON Parsing in Python: Boosting Data Manipulation and Validation
      • Introduction to Transfer Learning with Python: A Practical Guide
      • How to Check Type in Python
      • How to make web crawler in python?
      • Why was the language called “python”?
      Contact
      •   support@pythonpoint.com

      We get you the best Python Courses and Blogs aiming to provide skill.

      We Believe Skill is much more important than a Degree

      Company
      • About Us
      • Blog
      • Offers
      • Contact
      Useful Links
      • Courses
      Support
      • Need Support

      © 2020 ALL RIGHTS RESERVED​ PYTHONPOINT.NET

      PythonPoint

      • Terms of Use
      • Refund Policy
      • Privacy Policy

      Login with your site account

      Lost your password?

      Not a member yet? Register now

      Register a new account

      Are you a member? Login now

      wpDiscuz