How can one use standard functions for filter and map? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can one use standard functions for filter and map?

see code https://code.sololearn.com/cz4OZA0F91J0/?ref=app

3rd Apr 2020, 6:39 AM
nichdiomajadoch
5 Answers
+ 4
print(list(map(str.lower,"abx"))) print(filter(str.isalpha,list("123abc")))
3rd Apr 2020, 6:50 AM
Kevin ★
+ 3
Shaxzoda Sherzodovna May you not answer like that in discussion forum. Let it be to those who knows. Follow community guidelines of the forum from here- https://googleweblight.com/i?u=https://www.sololearn.com/Content-Creation-Guidelines/&hl=en-IN
3rd Apr 2020, 6:57 AM
Tricker
0
Kevin Star it works! Great. Thank you! But why as method of str? Lambdas are pure functions. oh wait... there is a difference between len(str) and str. lower(). Is it that?
3rd Apr 2020, 7:05 AM
nichdiomajadoch
0
got it from functools import reduce import string print(reduce(str.__add__,filter(lambda c: c.isalpha() or c == " ",(list(input())[::-1])))) 🕷️🕷️
3rd Apr 2020, 8:49 AM
nichdiomajadoch
- 2
I dont know
3rd Apr 2020, 6:41 AM
Shaxzoda Sherzodovna
Shaxzoda Sherzodovna - avatar