Guest User

Median of three values - 10

a guest
Sep 26th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. def median_v10(a,b,c):
  2.     if (a < b):
  3.         if (b < c):
  4.             #1 2 3
  5.             result = b
  6.         else:
  7.             if (c < a):
  8.                 #1 3 0
  9.                 result = a
  10.             else:
  11.                 #1 6 5
  12.                 result = c
  13.     else:
  14.         if (b < c):
  15.             if (c < a):
  16.                 #6 3 5
  17.                 result = c
  18.             else:
  19.                 #6 3 9
  20.                 result = a
  21.         else:
  22.             result = b
  23.     return result
Advertisement
Add Comment
Please, Sign In to add comment