Library Shelf
Python
30 pts
Library Shelf
A school library in Asmara organises one shelf. Start from the given list and do these steps in order:
maths_copies— count how many times"Maths 9"appears.- Remove one
"Maths 9". - Add
"Chemistry"to the end. - Insert
"Atlas"at the beginning. - Sort the shelf alphabetically.
last_book— take the last book off the shelf withpop().
Print maths_copies, last_book and books. Expected output:
2 Python Basics ['Atlas', 'Biology', 'Chemistry', 'English 9', 'Maths 9']
Checklist
- Create
maths_copies, the number of"Maths 9"books, before you change the shelf. - Keep the list
books, remove one"Maths 9", add"Chemistry"to the end and insert"Atlas"at the beginning. - Sort the shelf, then take the last book off with
pop()and store it inlast_book. - Print
maths_copies,last_bookandbooks.
🔑 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.
