Removing duplicate in case insensitive list. eg fruits=['banana', 'Banana', 'Mango', 'mango', 'orange', 'OranGe'] set(map(str.lower, fruits)) will give you: {'orange', 'banana', 'mango'}
It's very simple) You are trying to change the values of the set. You forget that the values in it are immutable, so the lower case will not work. In this situation, it is necessary to bring to one register earlier
Right, but set is applied right after we lower the case for all items. demo: online-python.com/isJQnjgrZf
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Removing duplicate in case insensitive list.
eg fruits=['banana', 'Banana', 'Mango', 'mango', 'orange', 'OranGe']
set(map(str.lower, fruits))
will give you: {'orange', 'banana', 'mango'}
It's very simple) You are trying to change the values of the set. You forget that the values in it are immutable, so the lower case will not work. In this situation, it is necessary to bring to one register earlier
Right, but set is applied right after we lower the case for all items.
demo: online-python.com/isJQnjgrZf