Files
ITMO/Informatics/InfLab3/Informatics_Lab3_Task2.py
T
LeterZP a51dfe26c0 Add 'Informatics/InfLab3/' from commit '7e065b45b7cf20a1fc712723ec31119e8c9f9ac6'
git-subtree-dir: Informatics/InfLab3
git-subtree-mainline: 3c886c1b43
git-subtree-split: 7e065b45b7
2026-02-13 19:42:47 +03:00

35 lines
834 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Author = Bosenko Boris Igorevich
# Group = P3115
# Date = 12.11.2025
import re
def mail(email):
if re.fullmatch(r'[\w.]*@[a-zA-Zа-яА-я]+(\.[a-zA-Zа-яА-я]+)+', email):
return email[email.index("@") + 1:]
else:
return "Fail!"
if __name__ == "__main__":
try:
tests = [
"day@dfgdfg..",
"ind_out.us@out_because.us",
"2let@it.be.me",
"no_here.there@and.there",
"1322list@another8916.21"
]
for test in tests:
print(mail(test), end=" ")
print()
results = [
"not.here",
"Fail!",
"it.be.me",
"and.there",
"Fail!"
]
print(*results, sep=" ")
except Exception as error:
print(f"Ошибка: {error}")