Python program to clone or copy list.

#Python program to clone or copy list.

list1=[]
list2=[]

N=int(input("Enter number of elements in list1:"))

for i in range (N):
    array=int(input("Enter an element for position %d:"%i))
    list1.append(array)

print("Original list is:")
print(list1)

list2=list1

print("\nCloned list is:")
print(list2)

Comments

Popular posts from this blog

Python program to calculate age and year when user will be 100 years old

Python program to check if the entered string is pangram or not using function.