We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71f5b39 commit 41164f4Copy full SHA for 41164f4
Week05/emails_aysenur_sariot.py
@@ -0,0 +1,24 @@
1
+import re
2
+
3
+class Emails(list):
4
+ def __init__(self, data):
5
+ self.validate(data)
6
+ unique_emails = list(set(data))
7
+ super().__init__(unique_emails)
8
+ self.data = unique_emails
9
10
+ def validate(self, data):
11
+ if not all(isinstance(x, str) for x in data):
12
+ raise ValueError("Tüm öğeler string olmalıdır.")
13
14
+ pattern = re.compile(r"^[\w\.-]+@[\w\.-]+\.\w+$")
15
16
+ for email in data:
17
+ if not pattern.match(email):
18
+ raise ValueError(f"Geçersiz e-posta adresi: {email}")
19
20
+ def __repr__(self):
21
+ return f"Emails({list(self)})"
22
23
+ def __str__(self):
24
+ return "\n".join(self)
0 commit comments