Write a Python function to find the Max of three numbers

Introduction

Write a Python function to find the Max of three numbers. I have used python 3.7 compiler for debugging purpose.

def max_of_two( x, y ):
    if x > y:
        return x
    return y
def max_of_three( x, y, z ):
    return max_of_two( x, max_of_two( y, z ) )
print("max number among three is:")
print(max_of_three(10, 30, 20))

Result

Write a Python function to find the Max of three numbers
Write a Python function to find the Max of three numbers

Leave a Comment