Try It Out Using More Methods

You can now invoke your ch6.py file with python c i or the Run with Interpreter command so that you can use everything you've added to the Fridge class. If you get errors instead of the >cc prompt, pay attention to the exception raised and try to fix any indentation, spelling, or other basic errors identified.

The class should be usable like this now:

c>> f = Fridge({"eggs":6, "milk":4, "cheese":3}) c>c if f.has("cheese", 2):

... print("It's time to make an omelet!")

It's time to make an omelet!

0 0

Post a comment