Dremendo Tag Line

Input 10 numbers in integer list and check all numbers are same or not using in Python

Lists - Question 2

In this question, we will see how to input 10 numbers in integer list and check whether all numbers in it are same or not in Python programming. To know more about lists click on the lists lesson.

Q2) Write a program in Python to input 10 numbers in integer list and check whether all numbers in it are same or not.

Program

c=0
a=list()

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

for i in range(10):
    if a[0]==a[i]:
        c=c+1

if c==10:
    print('All numbers are same')
else:
    print('All numbers are not same')

Output

Enter 10 numbers
2
2
2
2
2
2
2
2
2
2
All numbers are same
video-poster