Python Data Types

In Python, variables can hold the values of different types that are called data type. Python Data Types are used to define the operations and store each of them. There are five types of Python Data Types are exists.

  • Numbers
  • String
  • List
  • Tuple
  • Dictionary
  • 1. Numbers : Numbers are refers to a numeric value. In Python, there are four types of numbers are exists.

  • integer
  • long integer
  • floating point
  • complex number
  • 2. String : String is a group of characters. In Python, you can use a string some following ways :

  • using single quotes – For example, a string can be write as ‘Python’ .
  • using double quotes – For example, a string can be write as “Python” .
  • using triple quotes – For example, a string can be write as ”’Python”’ .
  • 3. List : Lists consists of items separated by commas and enclosed within square brackets([]). It is the most versatile data types in Python Programming Language.
    Example :


    Output :

    4. Tuple : A tuple is also consists of a number of values separated by commas and enclosed within parenthesis. But you can’t change the values in a tuple. So, tuple is called read-only data type.
    Example :

    Output :

    5. Dictionary : In Python, Dictionary is used to stores the data in key-value pairs. The key-values are basically strings and the value can be of any data type. The key value pairs are enclosed with curly braces({}) and each key-value pair is separated from the other using a colon (:).
    Example :

    Output :

    Recommended Posts:

        1. Python Features
        2. Python Applications
        3. Python Keywords
        4. Python installation
        5. Python variables and identifiers
        6. Python Data Types
        7. Python Operators
        8. Type Conversion in Python
        9. Python Program to Find Area Of Circle
        10. Python Conditional Statements : if-else, elif, nested if statements
        11. Python Loops
        12. Python Program to Check Armstrong Number
        13. Python Program to Print Pascal Triangle
        14. Python Program to Find the Square Root