DEV Community

Discussion on: Python | Isogram Problem!

Collapse
 
vidit1999 profile image
Vidit Sarkar

Let's take the example , s = "Six-Year- Old".
replace('-', '') , replace(' ', '') will going to replace all -'s and spaces with empty character respectively. lower() will lowercase all charecters.
So, cleaned will be, cleaned = 'sixyearold'.

Now, set(cleaned) stores all unique characters of cleaned. So, if count of all unique characters is same as length of cleaned then all characters of cleaned are unique.

len(set(cleaned)) == len(cleaned) will be True if all characters of cleaned are unique, else False.

Thread Thread
 
banji220 profile image
Banji

Tnx Vidit Sarkar for your amazing explanation .
I appreciate that.

Keep Moving Forward

Code with 💛

🅑🅐🅝🅙🅘