Advertisement
FelipeNeto2

Max_num(PYTHON)

Dec 10th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. # Write your max_num function here:
  2. def max_num(num1, num2, num3):
  3.   if num1 > num2 and num1 > num3:
  4.     aux = num1
  5.     control = True
  6.   elif num2 > num1 and num2 > num3:
  7.     aux = num2
  8.     control = True
  9.   elif num3 > num1 and num3 > num2:
  10.     aux = num3
  11.     control = True
  12.   else:
  13.     return "It's a tie!"
  14.     return False
  15.   if control == True:
  16.     return aux  
  17.    
  18. # Uncomment these function calls to test your max_num function:
  19. print(max_num(-10, 0, 10))
  20. # should print 10
  21. print(max_num(-10, 5, -30))
  22. # should print 5
  23. print(max_num(-5, -10, -10))
  24. # should print -5
  25. print(max_num(2, 3, 3))
  26. # should print "It's a tie!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement