Python Data Types

Introduction

Python boasts a rich set of built-in data types, enabling you to store and manipulate various kinds of information. Understanding these types is crucial for writing effective Python code.

Fundamental Data Types

1. Numeric Types

These types are used to represent numbers.

2. Sequence Types

These types allow you to store an ordered sequence of items.

3. Mapping Type

A mapping type stores data in key-value pairs.

4. Set Types

These types store a collection of unique, unordered items.

5. Boolean Type

Represents truth values: True or False.

                
                    # Example:  Checking if a number is even
                    def is_even(number):
                        if number % 2 == 0:
                            return True
                        else:
                            return False
                    
                    print(is_even(4))  # Output: True
                    print(is_even(7))  # Output: False