Exercise
Even Number Array
Objective
Develop a Python program to prompt the user for 10 integer numbers and display the even ones.
Example Python Exercise
Show Python Code
# Program developed by: Programmer 1, Programmer 2
# Initialize an empty list to store the integers
numbers = []
# Prompt the user for 10 integer numbers
for i in range(10):
number = int(input(f"Enter integer number {i+1}: "))
numbers.append(number)
# Display the even numbers
print("The even numbers are:")
for number in numbers:
if number % 2 == 0:
print(number)
Output
Enter integer number 1: 4
Enter integer number 2: 7
Enter integer number 3: 10
Enter integer number 4: 11
Enter integer number 5: 14
Enter integer number 6: 18
Enter integer number 7: 21
Enter integer number 8: 24
Enter integer number 9: 25
Enter integer number 10: 30
The even numbers are:
4
10
14
18
24
30
Share this Python Exercise
Explore our set of Python Programming Exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of Python. From variables and data types to control structures and simple functions, each exercise is crafted to challenge you incrementally as you build confidence in coding in Python.
This Python program prompts the user to enter 10 real numbers and calculates two averages: one for the positive numbers and another for the negative numbers...
This Python program prompts the user to enter several numbers, calculating their sum as they go. The program continues to prompt the user for numbers until they enter...
This Python programming exercise is ideal for practicing the handling of multidimensional arrays. In this case, the goal is to prompt the user for the marks of 20 students, ...
This Python statistical program is a fantastic exercise for improving data handling and user interaction in programming. The program allows users to add new data...
This Python program is an excellent introduction to using NamedTuples for storing structured data. The program allows users to define 2D points with specific f...
In this exercise, you will develop a Python program that expands the previous exercise (NamedTuple point), allowing up to 1,000 points to be stored using an "array of...