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
- Take a list as input and create an empty list.
- Add every element from the given list to the empty list using for loop.
- 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
Python program to return True if two lists have any common member.
Python program to print a specific list after removing the 1st, 3rd, and 6th elements from the list.
Python program to remove negative values from the list.
Python program to get a list of all elements which are divided by 3 and 7.
Python program to check whether the given list is palindrome or not.
Python Program to get a list of words which has vowels in the given string.