-
Notifications
You must be signed in to change notification settings - Fork 3
/
Verify_Details.py
34 lines (30 loc) · 968 Bytes
/
Verify_Details.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
#IMPORT HERE..
import pandas as pd
#DEFINE CONSTANTS HERE..
DF_CONFIGURATION = None
ID_FORMAT = None
def define_constants(CODE):
global DF_CONFIGURATION, ID_FORMAT
DF_CONFIGURATION = pd.read_csv("./Question/" + CODE + "/Config.csv").set_index("Name")[['Value']]
ID_FORMAT = DF_CONFIGURATION.at['Id_format','Value']
def verify_details(unique_id, CODE):
define_constants(CODE)
if __name__ == '__main__':
print(ID_FORMAT)
if len(unique_id) != len(ID_FORMAT):
return False
for i,j in zip(ID_FORMAT, unique_id):
if i == 'a' or i == 'A':
if j.isalpha() != True:
return False
elif i == 'n' or i == 'N':
if j.isnumeric() != True:
return False
elif i == 'c' or i == 'C':
pass
else:
if i != j:
return False
return True
if __name__ == '__main__':
print(verify_details('a120188028'))