﻿ Python: Reverse strings in a given list of string values using lambda - w3resource # Python: Reverse strings in a given list of string values using lambda

## Python Lambda: Exercise-41 with Solution

Write a Python program to reverse strings in a given list of string values using lambda.

Sample Solution:

Python Code :

``````def reverse_strings_list(string_list):
result = list(map(lambda x: "".join(reversed(x)), string_list))
return result

colors_list = ["Red", "Green", "Blue", "White", "Black"]
print("\nOriginal lists:")
print(colors_list)
print("\nReverse strings of the said given list:")
print(reverse_strings_list(colors_list))
``````

Sample Output:

```Original lists:
['Red', 'Green', 'Blue', 'White', 'Black']

Reverse strings of the said given list:
['deR', 'neerG', 'eulB', 'etihW', 'kcalB']
```

## Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Returns all the elements of a list except the last one

Example:

```def tips_initial(lst):
return lst[0:-1]

print(tips_initial([1, 2, 3, 4]))
```

Output:

```[1, 2, 3]
```