Light Mode
Dark Mode
Use of a set ?!

I am surprised that people use a set for this "All different" exercice

Return len(set(elements)==1) is a short and readable code, but not efficient.

Imagine the work necessary to build the set for [1, 2, 3, 'A', 5, 5, 6, 'A', 'A', 'Azerty'], which obviouly, will definitively NOT be of length 1. while the test 1==2 makes the choice...

Created: July 25, 2018, 9:02 p.m.
Updated: July 26, 2018, 5:40 a.m.
1
5
User avatar
jfp053