3 ms·
Wouldn't it be easier to say if numbers == []: print ("The numbers list is empty") if your intent is to express "is the list empty?" in the conditi
by actually_a_dog 5y ago
Wouldn't it be easier to say
if numbers == []:
print ("The numbers list is empty")
if your intent is to express "is the list empty?" in the condition?
- sritchie 5y agoThat condition would fail on non-list sequences, like `numbers == (1,2,3)`; the `len` version makes the code more permissive.