0 out of 464 challenges solved

Count Integer Elements

Write a Python function `count_integer_elements(lst)` that takes a list `lst` as input and returns the number of integer elements in the list. The function should count only elements of type `int` (not `float` or other numeric types).

#### Example Usage
```python [main.nopy]
print(count_integer_elements([1, 2, 'abc', 1.2]))  # Output: 2
print(count_integer_elements([1, 2, 3]))          # Output: 3
print(count_integer_elements([1, 1.2, 4, 5.1]))  # Output: 2
```

#### Constraints
- The input list can contain elements of any type.
- The function should not count elements that are not of type `int`.
def count_integer_elements(lst):
    """
    Count the number of integer elements in the given list.

    Args:
        lst (list): The input list containing elements of various types.

    Returns:
        int: The count of integer elements in the list.
    """
    # Initialize a counter to zero
    count = 0
    # Iterate through the list and check each element
    for element in lst:
        # Placeholder for checking and counting integer elements
        pass
    # Return the final count
    return count