Computer Science, asked by akgamer3334, 2 months ago

b) Consider the lists L1 and L2 answer the questions that follows
L1=(1,3,5] L2=[6,7,8]
i) print(L1+L2)
ii) print(L2*3)​

Answers

Answered by allysia
3

Correction:

b) Consider the lists L1 and L2 answer the questions that follows

L1=[1,3,5] L2=[6,7,8]

Answer:

i) [1,3,5,6,7,8]

ii) [1, 3, 5, 1, 3, 5, 1, 3, 5]

Explanation:

  • Lists are extended to another when + operation is performed on them.
  • a*b: a is repeated b times once this operation is performed on the list a.

Additional:

  • L1.extend(L2) will return [1,3,5,6,7,8]. It extends the list to another and takes one argument at a time.

Similar questions