Write a Python program to remove and print every third number from a list of numbers until the list becomes empty.


Topic: Write a Python program to remove and print every third number from a list of numbers until the list becomes empty.

Solution

num = [10,20,30,40,50,60,70,80,90]
len_list = len(num)
position = 3 - 1
idx = 0
while len_list > 0:
    idx = (idx+position) % len_list
    print(num.pop(idx))
    len_list-=1 
	
	
	



List all Python Programs