param: start_idx (int) - an expected starting value for idx (default is 0); gets subtracted from idx for 0-based indexing The function first checks if i
def delete_item(...):
"""
param: info_list - a list from which to remove
an item
param: idx (str) - a string that is expected to
contain an integer index of an item in
the in_list
param: start_idx (int) - an expected starting
value for idx (default is 0); gets
subtracted from idx for 0-based indexing
The function first checks if info_list is empty.
The function then calls is_valid_index() to verify
that the provided index idx is a valid positive
index that can access an element from info_list.
On success, the function saves the item from info_list
and returns it after it is deleted from info_list.
returns:
If info_list is empty, return 0.
If is_valid_index() returns False, return -1.
Otherwise, on success, the function returns the element
that was just removed from info_list.
Helper functions:
- is_valid_index()
"""
![Deleting a category
• Define delete_item() in the functions.py (see the function stub below).
o A Implement this function according to the function documentation. Read the documentation carefully first, before
implementing anything.
Good news - you should have already implemented most of this functionality in the previous labs! :-)
Add the tests from the Test Your Code section to your tests.py
• Add (and run!) your own new assert statements - pay close attention to the cases described in the function documentation
that should cause errors.
• Test each case by writing separate assertions.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fccac55ee-732b-4607-a38e-f5bd0a8aacb2%2F47529acc-0912-49ab-9274-9ac8bb4cf438%2Ffpfdwwl_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)