Welcome to the Treehouse Community
Looking to learn something new?
what's the problem with this code ? Should in the_list all non-integer values to be removed.
the_list = ["a", 2, 3, 1, False, [1, 2, 3]] index = 0 while True: if type(the_list[index]) != int: del the_list[index] index = index + 1 if index >= len(the_list): break
Remember when you delete and index it shift everything over so what you should try is:
if type(the_list[index]) != int: del the_list[index] else: index = index + 1
So it only increment when an int is found. For example slot 0 will get deleted and when you do that slot 1 will become 0 and so forth. So when it delete False the list then moves to the False position and since you have it to increment the list gets skipped.
While your method will work with the afore mentioned tweaks I think you would be better served by a for loop here since it would eliminate the need for your index = index + 1.
the_list = ["a", 2, 3, 1, False, [1, 2, 3]] output_list = 
for value in the_list: if type(value) != int: output_list.append(value)
This will be a bit faster for a short list like this and will make your code a bit nicer to look at.
If you really want to keep your code style then one more simple change to make (in addition to what nighingale already told you) would be to replace index = index + 1 with index += 1. It does exactly the same thing but is a bit shorter, easier to look at, and quicker to type.