Question: Create a python file called email.py. Please Note, must include the following code below: user_choice = while user_choice != quit: user_choice = input(What would
Create a python file called email.py.
Please Note, must include the following code below:
user_choice = "" while user_choice != "quit": user_choice = input("What would you like to do - read/mark spam/send/quit?") if user_choice == "read": pass #Place your logic here elif user_choice == "mark spam": pass #Place your logic here elif user_choice == "send": pass #Place your logic here elif user_choice == "quit": print("Goodbye") else: print("Oops - incorrect input") Create a class definition for an Email which has three variables: has_been_read, email_contents, is_spam and from_address.
The constructor should initialise the senders email address.
The constructor should also initialise has_been_read and is_spam to false.
Create a function in this class called mark_as_read which should change has_been_read to true.
Create a function in this class called mark_as_spam which should change is_spam to true.
Create a list called inbox to store all emails.
Then create the following methods: add_email - which takes in the contents and email address from the received email to make a new Email object.
get_count - returns the number of messages in the store.
get_email - returns the contents of an email in the list. For this, allow the user to input an index i.e. GetEmail(i) returns the email stored at position i in the list. Once this has been done, has_been_read should now be true.
get_unread_emails - should return a list of all the emails that havent been read.
get_spam_emails - should return a list of all the emails that have been marked as spam.
delete - deletes an email in the inbox. Now that you have these set up, lets get everything working!
Fill in the rest of the logic for what should happen when the user inputs send/read/quit. Some of it has been done for you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
