Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Write your max_num function here:
- def max_num(num1, num2, num3):
- max = num1
- tie = ""
- for num in [num2, num3]:
- if num == max:
- tie = "It's a tie!"
- elif num > max:
- max = num
- if tie != "":
- return tie
- else:
- return max
- # Uncomment these function calls to test your max_num function:
- print(max_num(-10, 0, 10))
- # should print 10
- print(max_num(-10, 5, -30))
- # should print 5
- print(max_num(-5, -10, -10))
- # should print -5
- print(max_num(2, 3, 3))
- # should print "It's a tie!"
Advertisement
Add Comment
Please, Sign In to add comment