Issue
How would I go from
lst1 = ['the', 'brown', 'jumps', 'the', 'dog']
lst2 = ['quick', 'fox', 'over', 'lazy']
to this output:
['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog']
without defining a new function?
So far I've tried:
insertcounter = 1
for k in lst2:
lst1.insert(insertcounter, k)
insertcounter += 1
But it's just inserting the entire lst2 at the first index instead of looping through. I'm sure the answer is in plain sight but I'm a noob and it's not hitting me.
Thanks in advance!
Solution
Change insertcounter += 1
to insertcounter += 2
.
Answered By - Kelly Bundy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.