16. Problem to copy the list to another list.

In this program, we will take a user input as a list & copy the list to another list with the help of the below-given steps.

Copy the list:

Steps to solve the program
  1. Take a list as input and create an empty list.
  2. Add every element from the given list to the empty list using for loop.
  3. Print the list to see the output.
				
					#Input list
list1 = [1,2,4,7,0,5]

#Creating an empty list
list2 = []

for value in list1:
    list2.append(value)
    
#Printing output
print(list2)
				
			

Output :

				
					[1, 2, 4, 7, 0, 5]
				
			

Related Articles

Reverse a list with reversed and reverse methods

common elements between lists

Leave a Comment