Witam. Mam na ogół prosty problem ale im dłużej patrzę na projekt tym ciężej mi jest go rozwiązać. Mianowicie chodzi o to, żeby program po podaniu liczb do listy wypisać te mniejsze od x liczby.
numbers = []
amount = int(input('How many numbers do you want to add to the list? '+'\n'))
for number in range(0, amount):
numbers.insert(number, int(input('Enter the number: '+'\n')))
less_than = int(input('Number less than what I have to write?'+'\n'))
i = 0
while int(i) < amount-1:
if numbers[i] < less_than:
continue
elif numbers[i] >= less_than:
del numbers[i]
i = i + 1
print('These numbers are :')
for i in range(len(numbers)):
print(numbers[i])
Problemem jest to, że wyskakuje bład o złym indeksowaniu, ale nie mogę znaleźć w jaki sposób on zachodzi.