Python - User-Friendly Password System
Python - User-Friendly Password System
/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'authEvents' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts 2D_STRING_ARRAY events as parameter.
#
# def authEvents(events):
# # Write your code here
def authEvents(events):
print(events)
import string
if events[i][0] == 'setPassword':
lst= list(events[i][1])
ln = len(lst)
res =[]
res.append(hash_val(lst, ln))
for k in h:
lst_add= list(events[i][1])
lst_add.append(k)
ln_add = len(lst_add)
res.append(hash_val(lst_add, ln_add))
print(res)
if events[i][0] == "authorize":
if int(events[i][1]) in res:
ans.append(1)
else:
ans.append(0)
return ans
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
events_rows = int(input().strip())
events_columns = int(input().strip())
events = []
for _ in range(events_rows):
events.append(input().rstrip().split())
result = authEvents(events)
fptr.write('\n'.join(map(str, result)))
fptr.write('\n')
fptr.close()