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.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. def max_of_two( x, y ):
  2. if x > y:
  3. return x
  4. return y
  5. def max_of_three( x, y, z ):
  6. return max_of_two( x, max_of_two( y, z ) )
  7. print("max number among three is:")
  8. print(max_of_three(10, 30, 20))

Result

python language techstudy.org

     





Related Topics




Popular Posts