Python program to print numbers less than 5 from the list.

#Python program to print numbers less than 5 from the list.

array=[]
arr=[]

N=int(input("Enter number of elements in list:"))

for i in range(N):
    list=int(input("Enter element %d:"% (i+1)))
    array.append(list)


for i in range(N):
    if(array[i]<=5):
        arr.append(array[i])

print("Entered list is:\n", array)
print("\nList with only numbers less than 5 is:\n",arr)

Comments

Popular posts from this blog

Python program to calculate age and year when user will be 100 years old