212k views
5 votes
Write a program that will print "available" if medium is included in the list called inventory (it should be included at the start) and "sorry, out of stock" if it is not. then, add a script to remove medium after it has been purchased.

User TomKPZ
by
8.3k points

1 Answer

5 votes

Final answer:

To write a program that prints 'available' or 'sorry, out of stock' based on the availability of 'medium' in the 'inventory' list and removes it after purchase.

Step-by-step explanation:

To write a program that prints the appropriate message based on the availability of the 'medium' in the 'inventory' list, you can use Python programming language. You can check if 'medium' is included in the 'inventory' list using the 'in' keyword. If it is, you can print 'available'; otherwise, you can print 'sorry, out of stock'. To remove 'medium' from the 'inventory' list after it has been purchased, you can use the 'remove()' list method.

Learn more about Writing a program to check inventory availability and remove items here:

h

User Bogertron
by
7.6k points