Different Data Types in Python

1. Integers:

Integers are whole numbers, positive or negative, without decimal points.

        
            age = 25
            temperature = -10
        
    

2. Floats:

Floats are numbers with decimal points or numbers in scientific notation.

        
            pi = 3.14159
            scientific_notation = 6.022e23
        
    

3. Strings:

Strings are sequences of characters, enclosed in single (' ') or double (" ") quotes.

        
            name = 'John Doe'
            message = "Hello, World!"
        
    

4. Booleans:

Booleans represent two values: True or False. They are used for logical operations.

        
            is_python_fun = True
            is_raining = False
        
    

5. Lists:

Lists are ordered collections of items, enclosed in square brackets [ ] and separated by commas.

        
            fruits = ["apple", "banana", "cherry"]
            numbers = [1, 2, 3, 4, 5]
        
    

6. Tuples:

Tuples are similar to lists, but they are immutable (cannot be changed after creation) and enclosed in parentheses ( ).

        
            coordinates = (10, 20)
            rgb_color = (255, 0, 128)
        
    

7. Dictionaries:

Dictionaries are key-value pairs, enclosed in curly braces { }, where each key is associated with a value.

        
            person = {"name": "John", "age": 30, "city": "New York"}
            grades = {"Math": 95, "Science": 88, "History": 78}
        
    

Understanding different data types in Python is essential for building diverse and dynamic applications that can handle a wide range of data and operations.

Understand Python Data Types in 10 minutes YouTube Video