Convert a list into a tuple and multiply each element

In this pythin tuple program, we will convert a list into a tuple and multiply each element.

Steps to solve the program
  1. Create a list and an empty list.
  2. Use for loop to iterate over elements in the list.
  3. Multiply each element by 2 and add it to the empty list.
  4. Now convert the new list to a tuple using tuple().
  5. Print the output.
				
					list1 = [12,65,34,77]
list2 = []
for ele in list1:
    a = 2*ele
    list2.append(a)
    
tup = tuple(list2)
print("Origianl list: ",list1)
print("After multiplyting by 2: ",tup)
				
			

Output :

				
					Origianl list:  [12, 65, 34, 77]
After multiplyting by 2:  (24, 130, 68, 154)
				
			

remove an item from a tuple.

1 thought on “Convert a list into a tuple and multiply each element”

Leave a Comment