Skip to content

Instantly share code, notes, and snippets.

@ericmjl
Created July 18, 2014 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericmjl/d8650e4337a3ddf40fd3 to your computer and use it in GitHub Desktop.
Save ericmjl/d8650e4337a3ddf40fd3 to your computer and use it in GitHub Desktop.
"""
In response to Stack Overflow question: http://stackoverflow.com/questions/24830029/python-less-greater-than-issue#24830029
"""
def batpower(power):
if power >= 70:
return "good"
elif power <= 70 and power > 30:
return "ok"
elif power <= 30:
return "critical"
"""
It is critical to consider all cases explicitly where feasible. This comes from the zen of Python.
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment