Question: Title should be centered and in upper case. Items should be in alphabetical order. Width of the number column is 3. Numbers should be right-justified.

Title should be centered and in upper case.
Items should be in alphabetical order.
Width of the number column is 3. Numbers should be right-justified.
Partial solution:


Exercise : Inventory Report Write a function that prints an inventory report like the examples given below, when the report title (a string), print-width (an int), and list of items (as a suitable data structure, e.g., dictionary) is given to the function. Kitchen Inventory Report: - Title: Kitchen - Width: 15 Bookshop Inventory Report: - Title: Book Shop - Width: 25 Partial solution ercise requires string formatting methods you learned in an earlier lesson. def print_inventory(items, title, width): print_header(width, title) for k in sorted(items.keys()): print_item(k, items[k], width) print_total(calculate_total(items), width) def print_header(width, title): """ print the given title in the format of a banner. Example: print_header (10, ' hi) \#\#\#\#\#\#\#\#\# \#\#\# HI \#\#\# \#\#\#\#\#\#\#\#\# * The title is center aligned and in upper case Arguments: word -- (type:string) the title of the banner width -- (type:int) the width of the banner print('\#' *width) \# ADD YOUR CODE HERE def print_total(total, width): """ print the given total in the following format Example: print_total(5,12) total...: 5 == * The total is right-justified Arguments: total -- (type:int) the total to print
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
