Avsnitt 1. Kapitel 8
single
Challenge: Unpacking Multiple Elements
Svep för att visa menyn
Uppgift
Svep för att börja koda
Given a list of arbitrary length, write a function that unpacks the first two and last two elements and returns them as a tuple, using the * operator.
- Unpack the first two elements from the beginning of
list. - Unpack the last two elements from the end of
list. - Return a tuple in the order: first element, second element, second-to-last element, last element.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 8
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal