Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- number = int(input())
- pattern = r"@#+([A-Z][a-zA-Z0-9]{4,}[A-Z])@#+"
- while number != 0:
- string = input()
- match = re.match(pattern, string)
- if match:
- group = ""
- for i in match[1]:
- if i.isdigit():
- group += i
- if group:
- print(f"Product group: {group}")
- else:
- print("Product group: 00")
- else:
- print("Invalid barcode")
- number -= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement