Write a Python program that performs operations on a list of integers. Your program should do the following:

ICSE Class 10 Robotics & AI PYQ · 2025 Paper · Section B

5(iii)Written · 2025 · Section B · 2025 Paper

Write a Python program that performs operations on a list of integers. Your program should do the following:

Show SolutionHide Solution↓
numbers = [2, 4, 6, 9, 5]

print("Even numbers:")
for n in numbers:
    if n % 2 == 0:
        print(n)

print("Odd numbers:")
for n in numbers:
    if n % 2 != 0:
        print(n)
Even numbers:
2
4
6
Odd numbers:
9
5
← Previous questionNext question →

Browse the free Robotics & AI sample bank