Computer Science, asked by prathambillgates, 5 months ago

Write a program to create a copy of a list. In the list's copy, add 10 to its first and last elements
then display the list.​

Answers

Answered by pjgaikar06
5

# Python code to clone or copy a list

# Using append()

def Cloning(li1):

   li_copy =[]

   for item in li1: li_copy.append(item)

   return li_copy

 

# Driver Code

li1 = [4, 8, 2, 10, 15, 18]

li2 = Cloning(li1)

print("Original List:", li1)

print("After Cloning:", li2)

Similar questions