Python Practice › List Programs › Program 33
Reverse each string in a list
Write a Python program to reverse each string in a list.
Input
["Sqa", "Tools", "Online", "Learning", "Platform"]
Output
['aqS', 'slooT', 'enilnO', 'gninraeL', 'mroftalP']
Approach
- Apply
[::-1]to every item.
Solution
words = ["Sqa", "Tools", "Online", "Learning", "Platform"]print([w[::-1] for w in words])Output
['aqS', 'slooT', 'enilnO', 'gninraeL', 'mroftalP']
Learn the concept
New to this topic? Read the lesson, then come back.