This is an archived version of the course and is no longer updated. Please find the latest version of the course on the main webpage.

Another example class

Here is another example class (this time an inanimate object).

class Email:
    """ Email class that can send emails and print recipients.

        Yes, you should also document your classes with docstrings!
    """

    def __init__(self, recipients): 
        self.is_sent = False 
        self.recipients = recipients

    def send(self): 
        self.is_sent = True

    def print_recipients(self): 
        for recipient in self.recipients: 
            print(recipient)

email = Email(["Alice", "Bob"]) 
print(email.is_sent)
email.send() 
print(email.is_sent)
email.print_recipients()