Python Practice › List Programs › Program 33

Reverse each string in a list

EasyList Programs · 33 of 100

Write a Python program to reverse each string in a list.

Advertisement
Input
["Sqa", "Tools", "Online", "Learning", "Platform"]
Output
['aqS', 'slooT', 'enilnO', 'gninraeL', 'mroftalP']

Approach

  1. Apply [::-1] to every item.

Solution

Python
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.

More list programs

← All 100 List Programs

Leave a Comment