Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- def max_num(num1, num2, num3, sum=0, sum2=0):
- nums = [num1, num2, num3]
- # Przerobienie listy na set, odrzucamy w ten sposób zdublowane wartości i segregujemy od najmniejszego do największego
- myset = (set(nums))
- # Przerobienie set na listę, wartości zostały unikalne i posegregowane
- myset = (list(myset))
- # Dodanie w petli wszystkich elementow listy i setu, potem sprawdzamy wynik
- if (int(sum(nums)) == int(sum(myset))):
- return (max(nums))
- else:
- return ("It's a tie!")
- 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
Advertisement