Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Address Validator/AddressValidator.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
def addressVal(address):
dot = address.find(".")
at = address.find("@")
if (dot == -1):
print("Invalid")
elif (at == -1):
print("Invalid")
else:
import re


def addressVal(address: str) -> None:
address_pattern: str = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
if re.fullmatch(address_pattern, address):
print("Valid")
else:
print("Invalid")

print("This program will decide if your input is a valid email address")
while(True):
print("A valid email address needs an '@' symbol and a '.'")
x = input("Input your email address:")

addressVal(x)
print("This program will decide if your input is a valid email address")
while True:
print("A valid email address should look like 'example@gmail.com'")
address = input("Input your email address:")
addressVal(address)
Binary file not shown.