Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. def max_101(x , y):
  2. if max(x, y) == x:
  3. return x
  4. else:
  5. return y
  6.  
  7. assert max_101(1, 2) == y
  8. assert max_101(2, 1) == x
  9. assert max_101(3, 1) == x
  10.  
  11.  
  12.  
  13.  
  14. def max_of_three(x , y , z):
  15. if max(x, y, z) == x:
  16. return x
  17. elif max(x, y, z) == y:
  18. return y
  19. else:
  20. return z
  21.  
  22. assert max_of_three(2, 1, 1) == x
  23. assert max_of_three(1, 2, 1) == y
  24. assert max_of_three(1, 1, 2) == z
  25.  
  26.  
  27.  
  28.  
  29. def repeated_max_of_three():
  30. numbers = input(print("enter three numbers with spaces in between")
  31. x, y, z = numbers.split()
  32. while numbers != q:
  33. if max(x, y, z) == x:
  34. print(x)
  35. elif max(x, y, z) == y:
  36. print(y)
  37. else:
  38. print(z)
  39. if numbers = q:
  40. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement