Objective
Extended unpacking first, *middle, last = data gathers all the leftover elements in a list. It is the most readable way to separate the beginning and the end of a sequence.
Instructions
- The input is a line with at least 2 integers separated by spaces.
- Unpack with
first, *middle, last = numsand showFirst: ...,Middle: [...](the list),Last: ...andSum of the middle: ....
1 2 3 4 5
First: 1
Middle: [2, 3, 4]
Last: 5
Sum of the middle: 9
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise