Suppose, i have a list that has range from 1 to 50. I need to remove all the integers(elements) with factor f (user input) from the list. For example, if = 2, the program should remove 4, 6, 8, 10, … from the sequence of integers and print the remaining number of integers in the sequence. Functions() such as remove() or any other functions are not allowed for this exercise. I'm still learning.
Edit: I'm not allowed to use enumerate(), slicing, list comprehension. Sorry. If there's a better way of getting output than mine, I'm open to it.
lis = [1, 2, 3, 4, 5........51]
while True:
f = int(input())
if f == 0:
break
for i in lis:
if (i % f == 0 and i != f):
lis.remove(i)........#i cant figure how to remove without using remove()
c = len(lis)
print('Number of remaining integers:', c)