A function which receives a string and returns a value of ourselves different symbols, without register. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

A function which receives a string and returns a value of ourselves different symbols, without register.

f=lambda s='abcA'.lower(): len(set(s)) #It returned 4, but it is necessary to 3.

27th Dec 2019, 12:05 PM
Andrey Shintar
Andrey Shintar - avatar
2 Antworten
+ 1
Solved. Answer is: f=lambda s='abcA'.lower(): len(set(map(str.casefold, s)))
27th Dec 2019, 12:48 PM
Andrey Shintar
Andrey Shintar - avatar
0
Maybe it can be made in other way?
27th Dec 2019, 12:26 PM
Andrey Shintar
Andrey Shintar - avatar