-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask1.py
More file actions
26 lines (20 loc) · 878 Bytes
/
Copy pathtask1.py
File metadata and controls
26 lines (20 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def validate_email(email):
"""
This function validates if an email address meets the following conditions:
1. It contains exactly one '@' symbol.
2. It contains at least one '.' (dot) after the '@' symbol.
If any of these conditions are not met, the function will return "Invalid email".
If the conditions are met, the function will return "Valid email".
:param email: str - The email address to validate.
:return: str - "Valid email" if the email passes validation, otherwise "Invalid email".
"""
if email.count("@") != 1:
return "Invalid email"
local_part, domain_part = email.split('@')
if '.' not in domain_part:
return "Invalid email"
return "Valid Email"
# Example usage of the function
email_address = "Amit_ml@gmail.edu"
validation_result = validate_email(email_address)
print(validation_result)