Dremendo Tag Line

Input 10 numbers in integer array and print only two digit even numbers from it in Python

Arrays - Question 1

In this question, we will see how to input 10 numbers in integer array and print only the two digit even numbers from it in Python programming. To know more about arrays click on the arrays lesson.

Q1) Write a program in Python to input 10 numbers in integer array and print only the two digit even numbers from it.

Program

from array import *

a=array('i',[])

print('Enter 10 numbers')
for i in range(10):
    a.append(int(input()))

print('List of 2 digit even numbers')
for i in range(10):
    if a[i]>=10 and a[i]<=99 and a[i]%2==0:
        print(a[i],end=' ')

Output

Enter 10 numbers
81
23
42
6
94
30
15
63
19
2
List of 2 digit even numbers
42 94 30
video-poster