Appending to a list to remove elements from the list
Nike tiempo football boots 2018 i am just testing out how lists work in python and I find it to be very confusing and frustrating. The other error I am getting isTypeError: ‘type’ object has no attribute ‘__getitem__’
which is entirely nonsensical to me and not in any way helpful. What is wrong with my code? Why does nike tiempo football boots 2018 the interactions window behave differently than the other window? Why won’t append work like it does in the interactions window?
Your immediate problem is nike tiempo football boots 2018 list[count] which should be list1[count]. The builtin type list can’t nike mercurial victory 6 be indexed (since it’s a type, not a list), so you get the TypeError about the __getitem__() method not being supported. What would that line of code nike mercurial victory 6 do?
Append list1[count] to list2. So far, so good.So now list2 is None.The next time you call that line, you’ll get another TypeError because nike mercurial victory 6 you can’t append anything to NoneType objects.
So, what you should have written isWhile that would now work, it’s an extremely roundabout way to do this. Keeping track of indexes you don’t actually need is very unpythonic the language is much more expressive than that. Don’t nike tiempo football boots 2018 try to write Java programs in Python. Your function (if your aim really is to create a new list that contains all the objects in list1 that are the same as x for which I fail to see the point entirely) could be written as nike tiempo football boots 2018.