← Back to all posts
##### i need help to calculate the middle number anyone know
coolkidkelly

dont make it too complicated

Voters
JK-10KA-921949
coolkidkelly
hotnewtop
Wumi4

With your code, this shouldn't be too complicated. Just simply pack all the variables into one list, remove the largest and smallest, then keep only the middle variable in there.

Here is a example:

```.css-o0gntx{position:absolute;left:-9999px;}.css-4kcfpn{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-width:0;border-style:solid;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-basis:auto;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;outline:none;min-height:0;min-width:0;position:absolute;left:-9999px;}nums = [2, 6, 5] // Sample list of numbers
nums = nums.remove(max(nums)) // Remove the largest number in list
nums = nums.remove(min(nums)) // Remove the smallest number in list
print(nums[0]) // Print the first (and only) element in your list```

I know this is complex, but that's the only way I found so far.

Spacecraft

```.css-o0gntx{position:absolute;left:-9999px;}.css-4kcfpn{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-width:0;border-style:solid;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-basis:auto;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;outline:none;min-height:0;min-width:0;position:absolute;left:-9999px;}num = []
@coolkidkelly Python has a built in sort function for lists. The default order for `.sort()` is smallest to largest.