Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 02. Encrypting Password - Final exam 100/100
- ========================================================================================================
- # var1
- import re
- n = int(input())
- pattern = r'(.+)>(\d{3})\|([a-z]{3})\|([A-Z]{3})\|([^\<\>]{3})<\1'
- for _ in range(n):
- password = input()
- result = re.findall(pattern, password)
- if result:
- print(f'Password: {result[0][1]}{result[0][2]}{result[0][3]}{result[0][4]}')
- else:
- print('Try another password!')
- ========================================================================================================
- # var2 functions
- import re
- def extract_valid_pass_and_print_func(iterations, some_pattern):
- for _ in range(iterations):
- password = input()
- result = re.findall(pattern, password)
- if result:
- print(f'Password: {result[0][1]}{result[0][2]}{result[0][3]}{result[0][4]}')
- else:
- print('Try another password!')
- n = int(input())
- pattern = r'(.+)>(\d{3})\|([a-z]{3})\|([A-Z]{3})\|([^\<\>]{3})<\1'
- extract_valid_pass_and_print_func(n, pattern)
- ========================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement