alphabet character def index_checker index index index replace index i

 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
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
character = ['!', '?' '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '-', '+', '=', '~', '[', ']', '{', '}', ';', ':', '<', '>', '/']
def index_checker(index= ''):
index = index.replace('(', '')
index = index.replace(')', '')
index = index.replace('-', '')
index = index.replace(' ', '')
if len(index) !=6:
return False
for letter in index:
if letter in alphabet:
return False
for letter in index:
if letter in character:
return False
return True
index1 = '(989)987'
index2 = '66-67-69'
index3 = '766758595'
index4 = '987 578'
index5 = '78675p'
index6 = '$66666'
print index_checker(index1)