Distance

Created on Jan. 16, 2017 by Julien Palard

Find the distance between the two furthest apart values in a list.

Create a dist function, receiving a list of numbers (integers or floating points), and returning the bigger distance between any two given values, so typically the distance between the biggest and the smallest, like:

>>> dist([1, 2, 3])
2
>>> dist([1, 2, 3, 2.5])
2
>>> dist([1, 2, 3, 2.5, 3.5])
2.5
>>> dist([1, 2, 3, 2.5, 3.5, 120])
119
>>> dist([1, 2, 3, 2.5, 3.5, 120, -1000])
1120
  • There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
  • Keyboard shortcuts:
    • Ctrl-Enter: Send your code to the correction bot.
    • Escape: Get back to the instructions tab.
(Ctrl-Enter)