Advertisement
DiYane

Email

Sep 25th, 2023
1,345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. class Email:
  2.     def __init__(self, sender, receiver, content):
  3.         self.is_sent = False
  4.         self.sender = sender
  5.         self.receiver = receiver
  6.         self.content = content
  7.  
  8.     def send(self):
  9.         self.is_sent = True
  10.  
  11.     def get_info(self):
  12.         return f"{self.sender} says to {self.receiver}: {self.content}. Sent: {self.is_sent}"
  13.  
  14. emails = []
  15. line = input()
  16. while line != "Stop":
  17.     email = line.split(' ')
  18.     from_person = email[0]
  19.     to_person = email[1]
  20.     message = email[2]
  21.     current_email = Email(from_person, to_person, message)
  22.     emails.append(current_email)
  23.  
  24.     line = input()
  25.  
  26. indices = list(map(int, input().split(', ')))
  27.  
  28. for index in indices:
  29.     emails[index].send()
  30.  
  31. for email in emails:
  32.     print(email.get_info())
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement