You are on page 1of 3

1.

Code in Text:

#A python program printing the given list divisible by 5


#If the number is greater than 150, the loop will stop
list = [2, 10, 13, 15, 32, 42, 55, 65, 75, 122, 125, 145, 150, 175, 180, 200]
for x in list:
if (x > 150):
break
if(x % 5 == 0):
print(x)

Screenshot:
2. Code in Text:
#A python program printing the given list in reversed form
LIST = [10, 20, 30 , 40 , 50]
for x in reversed(LIST):
print(x)

Screenshot:
3. Code in Text:
rows = int(input('Enter the number of rows you want: '))
for x in range(0, rows):
z=x+1
for y in range(0, z):
print("*", end=' ')
print('')
i = -1
for x in range(rows, 0, i):
z=x-1
for y in range(0, z):
print("*", end=' ')
print('')

Screenshot:

You might also like