Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def perm(str1):
- L1 = list(str1)
- str2 = ""
- res = []
- for i in range(len(L1)):
- for j in range(len(L1)):
- if (i+j)%2 == 0:
- temp = L1[i]
- L1[i] = L1[j]
- L1[j] = temp
- for k in L1:
- str2 += k
- else:
- if str2 not in res:
- res.append(str2)
- str2 = ""
- else:
- str2=""
- res.remove(str1)
- return res
- def no_unique_pass(arr):
- no_uni_pass = 1
- L1_res = []
- for i in arr:
- res = perm(i)
- j = 0
- while j < len(arr):
- if bool(res.count(arr[j])):
- del arr[j]
- j += 1
- else:
- no_uni_pass += (len(arr) - 1)
- return no_uni_pass
- def main():
- L1 = []
- n = int(input("Enter the Number of Users : "))
- print("\nEnter the Users' password one-by-one...")
- for i in range(n):
- password = input("Enter the Password : ")
- L1.append(password)
- unique_pass = no_unique_pass(L1)
- print("Number of Unique Passwords : ", unique_pass)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement