J
John Salerno
Let me apologize in advance for what I'm sure is an achingly simple
question, but I just can't find the answer in either of my Python books.
I've tried a few tests with the interactive prompt, but they don't work
either.
All I'm trying to do is insert an item into a list, like so:
L = [1, 2, 4]
and I want to insert the integer 3 into the position L[2], so that the
list reads [1, 2, 3, 4]
I've tried all kinds of combinations of slicing assignment, but I always
get:
TypeError: can only assign an iterable
Can someone please embarrass me with the simple answer?
question, but I just can't find the answer in either of my Python books.
I've tried a few tests with the interactive prompt, but they don't work
either.
All I'm trying to do is insert an item into a list, like so:
L = [1, 2, 4]
and I want to insert the integer 3 into the position L[2], so that the
list reads [1, 2, 3, 4]
I've tried all kinds of combinations of slicing assignment, but I always
get:
TypeError: can only assign an iterable
Can someone please embarrass me with the simple answer?