Nylithius Nylithius - 1 year ago 115
Python Question

set time limitations for timer

Is there are nicer way to write the code like this?

# ugly piece of code
seconds = 0 if seconds < 0 else seconds
seconds = 86399 if seconds >= 86400 else seconds

I mean - I need to setup the strict possible range of seconds

Answer Source
seconds = max(0, min(86399, seconds))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download