If/else and while
# Google is encouraged. Type what you find, do not paste it.
# ---- Part 1: if/else ----
def sign(n):
"""Return the sign of n as a word.
sign(5) → positive
sign(-2) → negative
sign(0) → zero
Search: "python if else".
"""
raise NotImplementedError
def result(score):
"""Return "pass" when score is 50 or more, "fail" below.
result(80) → pass
result(50) → pass
result(49) → fail
Search: "python comparison operators".
"""
raise NotImplementedError
def in_range(n, low, high):
"""Return True when n sits between low and high, limits included.
in_range(5, 1, 10) → True
in_range(0, 1, 10) → False
in_range(10, 1, 10) → True
Search: "python and operator".
"""
raise NotImplementedError
def outside_range(n, low, high):
"""Return True when n is below low or above high.
outside_range(15, 1, 10) → True
outside_range(5, 1, 10) → False
Search: "python or operator".
"""
raise NotImplementedError
# ---- Part 2: while ----
def countdown(n):
"""Print the numbers n down to 1, then Go!, each on its own line.
countdown(3) → 3, 2, 1, Go! (four lines)
Search: "python while loop".
"""
raise NotImplementedError
def sum_up_to(n):
"""Return 1 + 2 + ... + n using a while loop.
sum_up_to(4) → 10
sum_up_to(0) → 0
Search: "python while loop sum".
"""
raise NotImplementedError