in workshop-email-simulator/step-30 , when I write:
def list_emails(self):
if self.emails == []:
print('Your inbox is empty.\n')
return
it says: You should check if self.emails is empty using if not self.emails.
Why my code is wrong?
Lesson URL
ILM
September 24, 2026, 6:32pm
2
your code is not if not self.emails, the hint says to use that
the tests are not usually able to allow every possible solution, but if you think that some code should also be accepted you can create an issue on github
dhess
September 24, 2026, 6:33pm
3
This is a learning opportunity to point out how to easily evaluate a variable as true or false without needing an equality operator.
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and...
there it is (as Expected):
if not []:
print("Empty list is falsy") # outputs: Empty list is falsy
'''
Also, from @ILM reply post I understood where the problem lies. Thanks.