DEV Community

Cover image for Python Shots! - Data Types
Aman Jain
Aman Jain

Posted on

1

Python Shots! - Data Types

Python Data Types :

  • None
  • Numeric
    • int (num = 2)
    • float (num = 2.5)
    • complex (num = 1 + 2j)
    • bool (is_num = True)
  • sequence
    • List - [1,2,3]
    • Tuple - (1,2,3)
    • Set - {1,2,3}
    • String - ( str = "aman" )
    • Range - ( range(10) )
  • map
    • Dictionary - {"key":"value"}

Description in Brief

  1. List

    • [10,20,30]=> to store list of elements
    • mutable/can update value
    • used when you need to update values time to time
  2. Tuple

    • (1,34,56,7,89,5) => to store list of elements
    • indexing from 0
    • immutable/ can not update values
    • good and fast while looping through of getting data as it can't be updatable
  3. Set

    • {23,56,78,90,54} => to store list of elements
    • no indexing
    • stores unique elements only no repeatation
    • fast for searching as it uses hash table concept
  4. Dictionary

    • {"key":"value"} => store elements in key value pairs
    • custom indexing
    • used to deal with complex data like data inside data

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more