41.8k views
0 votes
Assume that print_list is a function that expects one parameter, a list. The function prints the contents of the list; it does not return a value.

Assume that inventory is a list, each of whose elements is an int.
Write a statement that prints the contents of the list inventory by calling the function print_list?.

A) Print_list(inventory).
B) Inventory.print_list().
C) Inventory.print_list(inventory).
D) Print_list.print(inventory).

1 Answer

6 votes

Final answer:

To print the contents of the list inventory, option A) Print_list(inventory) is the correct choice, following the conventional syntax for calling a function with an argument in many programming languages.

Step-by-step explanation:

The correct way to print the contents of the list inventory by calling the function print_list would be option A) Print_list(inventory).

This is the standard way to call a function in many programming languages, including Python, where you specify the function name followed by parentheses enclosing any arguments or parameters the function expects.

Since print_list expects a list as a parameter, you would pass inventory as the argument to the function.

User Gosi
by
8.7k points