Lambda Practice Question ( DS150423 ) - 22-05-2023

lst = [“Mango”,“Apple”,“Banana”]

Create a program using lambda to get below output for the above input

[“ognaM”,“elppA”,“ananaB”]

1 Like

lst = [“Mango”, “Apple”, “Banana”]
output = list(map(lambda x: x[::-1], lst))
print(output)

[‘ognaM’, ‘elppA’, ‘ananaB’]

2 Likes

image

lst = ["Mango", "Apple", "Banana"]

# Using lambda and map to reverse each string in the list
reversed_lst = list(map(lambda x: x[::-1], lst))

print(reversed_lst)
2 Likes
lst = ["Mango","Apple","Bananna"]
reverse = list(map(lambda lst:lst[::-1] , lst))
print(reverse)

Screenshot (363)

2 Likes
lst = ["Mango", "Apple", "Banana"]

result = list(map(lambda lst: lst[::-1], lst))

print(result)
2 Likes
lst = ["Mango","Apple","Banana"]
newlist = list(map(lambda word:word[::-1], lst))
print(newlist)
2 Likes