TypeError: list indices must be integers, not str Python
When you iterate over a list, the loop variable receives the actual list elements, not their indices. Thus, in your example s is a string (first abc, then def). It looks like what you’re trying to do is essentially this: orig_list = [‘abc’, ‘def’] map_list = [(el, 1) for el in orig_list] This is using … Read more