Greatest Parameter
The function greatest_parameter
should return the greatest value passed as a parameter. Examples:
greatest_parameter(2, 4, 9, 1, 1) # 9
greatest_parameter(0, 0, 1, 0, 0) # 1
greatest_parameter(0, -1, -1, -1, 0) # 0
Test Cases
test with negative values - Run Test
def test_with_negative_values():
assert greatest_parameter(0, -1, -1, -1, 0) == 0
test with ones and zeroes - Run Test
def test_with_ones_and_zeroes():
assert greatest_parameter(0, 0, 1, 0, 0) == 1
test with different numbers - Run Test
def test_with_different_numbers():
assert greatest_parameter(2, 4, 9, 1, 1) == 9
assert greatest_parameter(42, 4, 9, 1, 1) == 42
assert greatest_parameter(5, 4, 9, 1, 17) == 17
Solution 1
def greatest_parameter(a, b, c, d, e):
greatest = a
if b > a:
greatest = b
if c > greatest:
greatest = c
if d > greatest:
greatest = d
if e > greatest:
greatest = e
return greatest