While the if condition is required, the elif and else statements are not
Rewrite the code below to use elif and else
You have 10 minutes to complete the quiz
main()Built-in functions you can use: round(), input(), float(), str(), int() — you don’t have to use all of these
Write a function that does the following:
max_of_twoTest cases
Write a function that does the following:
max_of_threeTest cases
Write a function that does the following:
average_of_highestx, y and zarguments 1, 3, 4 should return 3.5
arguments 6, 4, 2 should return 5.0
arguments 4, 2, 1 should return 3.0
def average_of_highest(x, y, z):
if x >= z and y >= z:
return (x + y) / 2
elif y >= x and z >= x:
return (y + z) / 2
else:
return (x + z) / 2
def main():
print( average_of_highest(1, 3, 5) ) # should print 4.0
print( average_of_highest(6, 4, 2) ) # should print 5.0
print( average_of_highest(4, 2, 1) ) # should print 3.0
print( average_of_highest(2, 2, 1) ) # should print 2.0
print( average_of_highest(2, 1, 2) ) # should print 2.0
print( average_of_highest(1, 2, 1) ) # should print 1.5
main()4.0
5.0
3.0
2.0
2.0
1.5