Is this the right way to do lambda method chaining in python? I come from java background and I am trying to implement lambda chaining in Python. Below is my code
li = [&quot;amol&quot;, &quot;vikas&quot;, &quot;rahul&quot;]
li2 = list(filter(lambda n: (n == &quot;Amol&quot;), list(map(lambda name: (name.capitalize()), li))))
print(li2)

This Function will

Capitalize the names
Filter the names with &quot;Amol&quot;

Currently the code is running well but it seems to be cluttered and complicated when compared to java
You're better off doing an inline list comprehension.
li2 = [name.capitalize() for name in li if name == &quot;amol&quot;]

For the lambda implementation itself, you can leave the map and filter generators until only when you want to convert back to list:
li2 = filter(lambda n: n == &quot;Amol&quot;, map(str.capitalize, li))
print(list(li2))