Given a list iterate it and display numbers which are divisible by 5 and if you find number greater than 150, stop the loop iteration. 3
LIST1 = [12, 15, 32, 42, 55, 75, 122, 132, 150, 180, 200] EXPECTED OUTPUT: 15 55 75 150
Answers
Answered by
7
Input:
List1 = [12, 15, 32, 42, 55, 75, 122, 132, 150, 180, 200]
for i in range(0, len(List1), 1):
if List1[i]<=150:
if List1[i]%5==0:
print(List[i])
Output:
15
55
75
150
Answered by
3
Python program to display numbers that are divisible by 5 and to find numbers greater than 150, stop the loop iteration.
Explanation:
list1 = [12, 15, 32, 42, 55, 75, 122, 132, 150, 180, 200]
for i in list1:
if(i > 120):
break;
if i%5==0:
print(i)
Similar questions