Build an Email Simulator - Step 28

Tell us what’s happening:

Getting the error. Your conditional expression should evaluate to the string Read if the email is read and Unread if it’s not. Tried switching strings still didn’t work

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

    def display_full_email(self):
        self.mark_as_read()
        print('\n--- Email ---')
        print(f'From: {self.sender.name}')
        print(f'To: {self.receiver.name}')
        print(f'Subject: {self.subject}')
        print(f'Body: {self.body}')
        print('------------\n')

# User Editable Region
    def __str__(self):
        status = "Read" if self.mark_as_read() else "Unread"
        return (status)
            
# 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)

email1 = Email('bob', 'susan', 'aa', 'bb')
print(email1)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36 Edg/155.0.0.0

Challenge Information:

Build an Email Simulator - Step 28

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-email-simulator/685cdfd1932d8ac6ad986813.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @mostafa.a.kandil,

What attribute of Email does mark_as_read() update?

If you call that method like this, what does it return?

me = User("me")
you = User("you")
theEmail = Email(me,you,"Hello","Have a nice day!");
print(theEmail.mark_as_read())

Were you asked to use a return statement in this step?

Happy coding

My bad. Noticed the () on return and figured out it was supposed to be self.read thanks!