-
Notifications
You must be signed in to change notification settings - Fork 0
/
soru2.py
53 lines (48 loc) · 1.66 KB
/
soru2.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
def ozelKarakterVarmi(string, secim):
ozelKarakterler = "~`!#$%^&*()+=}{[]|\/:;\"'<>,.?"
ozelKarakterler2 = "~`!@#$%^&*()-_+=}{[]|\/:;\"'<>,?"
ozelKarakterler3 = "~`!@#$%^&*()-_+=}{[]|\/:;\"'<>.,?"
if secim == 1:
for i in range(len(string)):
for j in range(len(ozelKarakterler)):
if string[i] == ozelKarakterler[j]:
return True
elif secim == 2:
for i in range(len(string)):
for j in range(len(ozelKarakterler2)):
if string[i] == ozelKarakterler2[j]:
return True
elif secim == 3:
for i in range(len(string)):
for j in range(len(ozelKarakterler3)):
if string[i] == ozelKarakterler3[j]:
return True
return False
def mailDogrula(email, uzunluk):
if '@' not in email:
return False
elif email.count('@') > 1:
return False
elif len(email.split('@')[0]) == 0:
return False
elif len(email.split('@')[1]) == 0:
return False
elif len(email.split('.')[1]) != uzunluk:
return False
elif ozelKarakterVarmi(email.split('@')[0], 1):
return False
elif ozelKarakterVarmi(email.split('@')[1], 2):
return False
elif ozelKarakterVarmi(email[-1], 3):
return False
elif email.count('.') > 2:
return False
elif uzunluk > 3:
return False
return True
uzanti_u = int(input("Uzantinin uzunlugu: "))
mail = input("Mail adresi: ")
if mailDogrula(mail, uzanti_u):
print('Mail adresiniz dogrudur.')
else:
print('Mail adresiniz yanlistir.')