33. Problem to reverse each element of the list.

In this program, we will take a user input as a list and reverse each element of the list with the help of the below-given steps.

Reverse each element in a list:

Steps to solve the program
  1. Take a list of words as input and create an empty list.
  2. Use for loop to iterate over each element of the list.
  3. Reverse each element using Indexing.
  4. After reversing the word add it to the empty list.
  5. Print the list to see the output.
				
					#Input list
list1 = ["Sqa","Tools","Online","Learning","Platform’"]

#Creating an empty list
list2 = []

for word in list1:
    list2.append(word[::-1])

#Printing output
print(list2)
				
			

Output :

				
					['aqS', 'slooT', 'enilnO', 'gninraeL', '’mroftalP']
				
			

Related Articles

difference between two lists

Combine two list elements as a sublist

Leave a Comment