We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03f1006 commit d61a3c6Copy full SHA for d61a3c6
Validating UID.py
@@ -0,0 +1,16 @@
1
+import re
2
+n = int(input())
3
+upper_check = r'.*([A-Z].*){2,}'
4
+digit_check = r'.*([0-9].*){3,}'
5
+alphanumeric_and_length_check = r'([A-Za-z0-9]){10}$'
6
+repeat_check = r'.*(.).*\1'
7
+for i in range(n):
8
+ uid_string = input().strip()
9
+ upper_check_result = bool(re.match(upper_check,uid_string))
10
+ digit_check_result = bool(re.match(digit_check,uid_string))
11
+ alphanumeric_and_length_check_result = bool(re.match(alphanumeric_and_length_check,uid_string))
12
+ repeat_check_result = bool(re.match(repeat_check,uid_string))
13
+ if upper_check_result and digit_check_result and alphanumeric_and_length_check_result and not repeat_check_result:
14
+ print('Valid')
15
+ else:
16
+ print('Invalid')
0 commit comments