3 ms·
It means you have two extra special cases: 1) list is empty; 2) left edge is the right edge (I.e. length is 1)
by elephantum 8y ago
It means you have two extra special cases: 1) list is empty; 2) left edge is the right edge (I.e. length is 1)
- riskable 8y agoNothing that can't be solved with more conditionals! Conditionals are great because they're clear and concise... if not list: # Can't do anything with this return # or raise error if len(list) < 3: # Ditto return #ditto Sure, there's more code but it's not bad code. It's just straightforward stuff that's easy to read and debug (if necessary).