Build an Email Simulator - Step 23

Tell us what’s happening:

This is a comment to the authors rather than a help request.
The line of code below (line 24 at step 23) badly needs some explanation. I never would have figured it out.
receiver.inbox.receive_email(email)

Your code so far

class Email:
    def __init__(self, sender, receiver, subject, body):
        self.sender = sender
        self.receiver = receiver
        self.subject = subject
        self.body = body
        self.read = False

    def mark_as_read(self):
        self.read = True


# User Editable Region

    def display_full_email(self):
        self.mark_as_read()
        print('\n--- Email ---')


# User Editable Region


class User:
    def __init__(self, name):
        self.name = name
        self.inbox = Inbox()

    def send_email(self, receiver, subject, body):
        email = Email(sender=self, receiver=receiver, subject=subject, body=body)
        receiver.inbox.receive_email(email)

class Inbox:
    def __init__(self):
        self.emails = []
    
    def receive_email(self, email):
        self.emails.append(email)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0

Challenge Information:

Build an Email Simulator - Step 23

What should the explanation be?

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

I don’t know what the explanation should be as I can only guess what that line means, what it does. It is not intuitive and warrents some explanation.

Line 24, so you are not talking about this step with the print statements?

I guess you wrote that line in a previous step?

Are you talking about Step 16?

https://www.freecodecamp.org/learn/python-v9/workshop-email-simulator/step-16

You think this needs more explanation?

For me, absolutely. The only reason I got past that step was that the solution was provided when you “check your code”. Thanks for listening!