Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import re
  2.  
  3. regex = r"^[|](?P<name>[A-Z]{4,})[|][:][#](?P<title>[A-Z]{1}[a-z]+[ ][a-z]+)[#]$"
  4.  
  5. for n in range(int(input())):
  6.     text = input()
  7.     matches = re.match(regex, text)
  8.     if matches:
  9.         name = matches.group("name")
  10.         title = (matches.group("title")).split()
  11.         title_print = " ".join(title)
  12.  
  13.  
  14.         print(f"{name}, The {title_print}")
  15.         print(f">> Strength: {len(name)}")
  16.         print(f">> Armour: {len(title_print)}")
  17.     else:
  18.         print("Access denied!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement