repl.it
@ethanheys/

email validater

Python

No description

fork
loading
Files
  • main.py
main.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import re


class Validator(object):

    def __init__(self, email):
        self.email = email

    def check_for_symbol(self):
        if re.search("[@]", self.email) is None:
            return False
        else:
            return True
    
    def lol(self):
        if re.search("[.]", self.email) is None:
            return False
        else:
            return True
   
    def check_length(self):
        if len(self.email) >= 12:
            return True
        else:
            return False


def email_to_verify():
    return input("Enter your email address ")


def check_email(email):
    validator = Validator(email)
    symbol = validator.check_for_symbol()
    if symbol is False:
        print ("Your email address is not valid. failed to use @ ")

    
    sym = validator.lol()
    if sym is False:
        print ("Your email address is not valid. failed to use . ")
    
    length = validator.check_length()
    if length is False:
        print ("Your email is not valid. must use 12 or more characters")

    if length and symbol and sym is True:
        print ("Email is a valid email address.")


if __name__ == '__main__':
    e = email_to_verify()
    check_email(e)