Back to Lesson

Absolute Summation

Chain multiple built-in functions seamlessly.

Instructions

  • Given a list of financial variations:
    deltas = [-4.5, 2.1, -8.9, 1.2, -0.4]
  • You want the total absolute change.
  • Use a generator expression (or a loop) to take the
    abs()
    of every number, then
    sum()
    the results, and finally
    round()
    to 1 decimal place. Print the final result.
main.py
main.py