Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- def find_name(string):
- boss_regex = r"\|[A-Z]+\|"
- match = re.findall(boss_regex, string)
- result = "".join(match).strip('|')
- if len(result) >= 4:
- return result
- else:
- return None
- def find_title(string):
- title_regex = r"(?<=\|\:\#)[A-Za-z]+[ ][A-Za-z]+(?=#)"
- title = re.findall(title_regex, string)
- if len(title) > 0:
- return "".join(title)
- else:
- return None
- def return_results(string):
- name = find_name(string)
- title = find_title(string)
- if name is not None and title is not None:
- return f"{name}, The {title}\n>> Strength: {len(name)}\n>> Armour: {len(title)}"
- else:
- return "Access denied!"
- lines_of_input = int(input())
- for i in range(lines_of_input):
- user_input = input()
- print(return_results(user_input))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement