Sobes.tech
Intern — Senior

Selection of true elements from the list

livecode

Task condition

It is necessary to perform a transformation and filter the original array using list comprehension (a built-in loop) so that only those elements that Python considers true remain in the resulting list.

values = [1.1, False, 18, '', 0, '□', 'Ω', {'id': 777}, True, 'hello', 0.0, '○', None]
filtered = [v for v in values if v]