2. Problem to add elements from list1 to list2.

There are two ways to add elements from list1 to list2, fone is concatenation with the plus operator and the second one is to add elements with extend method with the help of the below-given steps.

Method 1 : Using concatenation

Add elements:

Steps to solve the program
  1. Take two lists as inputs.
  2. Add them using the ” ” operator.
  3. Print the final list.

Output :

Method 2 : Using extend()

Steps to solve the program
  1. Take two lists as input.
  2. Combine both lists using extend().
  3. Print the combined list.

Output :

Related Articles

Square of each number

Sum of all list elements.

Leave a Comment