homework confusion

MRAB python at mrabarnett.plus.com
Wed Apr 12 22:47:12 EDT 2017


On 2017-04-13 03:13, Lauren Fugate wrote:
[snip]

Read the last 2 paragraphs again:

""So you should be able to create Lockable objects with commands* like 
Lockable("front door", "in the foyer", house_key, False, True) 
(returning an object that starts out closed and locked), or 
Lockable("diary", "under Sam's bed", tiny_key, True) (returning an 
object that starts out open and unlocked), or Lockable("ancient treasure 
chest", "at the bottom of the sea", rusty_key) (returning an object that 
starts out closed and unlocked).
*Assuming that the variables house_key, tiny_key, and rusty_key already 
exist and refer to instances of Things.
"""

It gives """Lockable("diary", "under Sam's bed", tiny_key, True)""" as 
an _example_ of how it would be used.

The final sentence is also important.

Try defining 'tiny_key' before testing the example.


More information about the Python-list mailing list