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
- Take a list of words as input and create an empty list.
- Use for loop to iterate over each element of the list.
- Reverse each element using Indexing.
- After reversing the word add it to the empty list.
- 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
Python program to combine two list elements as a sublist in a list.
Python program to get keys and values from the list of dictionaries.
Python program to get all the unique numbers in the list.
Python program to convert a string into a list.
Python program to replace the last and the first number of the list with the word.