the code takes user input in list L and displays only the numbers which are divisible by 5 or 7 or both in ascending order.
i need the output in the form of a list M and i don't know how to execute this. for example,
input 4 5 35 7 8 9 14 10
output [5, 7, 10, 14, 35]
but the output i get, is:- 5 7 10 14 35
how do i incorporate list M?
L=[int(i)for i in input().split()]
L.sort()
for i in L:
if(i%5==0 and i%7==0):
print(i)
elif(i%5==0):
print(i)
elif(i%7==0):
print(i)