Plan the Delivery Route
Python
25 pts
Plan the Delivery Route
A delivery driver plans a route. Build the list route, starting from an empty list:
- Add all the
morningstops withextend(). - Add the item
"Lunch break"withappend(). - Add all the
afternoonstops withextend(). - The
urgentstop must come first: useinsert().
The lists morning and afternoon must not change. Print route and its length. Expected output:
['Mendefera', 'Asmara', 'Keren', 'Lunch break', 'Massawa', 'Dekemhare'] 6
Checklist
- Start
routeas an empty list and add the morning stops, then"Lunch break", then the afternoon stops. Do not changemorningorafternoon. - Put the
urgentstop first withinsert(). - Print
routeand then its length.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
