ayaderaghul

Untitled

Jul 9th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. # Write your max_num function here:
  2. def max_num(num1, num2, num3):
  3.   max = num1
  4.   tie = ""
  5.  
  6.   for num in [num2, num3]:
  7.     if num == max:
  8.       tie = "It's a tie!"
  9.     elif num > max:
  10.       max = num
  11.   if tie != "":
  12.     return tie
  13.   else:
  14.     return max
  15. # Uncomment these function calls to test your max_num function:
  16. print(max_num(-10, 0, 10))
  17. # should print 10
  18. print(max_num(-10, 5, -30))
  19. # should print 5
  20. print(max_num(-5, -10, -10))
  21. # should print -5
  22. print(max_num(2, 3, 3))
  23. # should print "It's a tie!"
Advertisement
Add Comment
Please, Sign In to add comment