Advertisement
go6odn28

emoji_decorator

Mar 26th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import re
  2.  
  3. text = input()
  4.  
  5. digits = [int(digit) for digit in re.findall(r"\d", text)]
  6. cool_threshold = 1
  7. if digits:
  8.     for digit in digits:
  9.         cool_threshold *= digit
  10. else:
  11.     cool_threshold = 0
  12.  
  13. print(f"Cool threshold: {cool_threshold}")
  14.  
  15. emojis = re.findall(r"((:{2}|\*{2})([A-Z][a-z]{2,})\2)", text)
  16. # emojis = re.findall(r"(:{2}|\*{2})([A-Z][a-z]{2,})\1", text)
  17. cool_emojis = []
  18.  
  19. for emoji in emojis:
  20.     emoji_name = emoji[2]
  21.     emoji_coolness = sum(ord(char) for char in emoji_name)
  22.     if emoji_coolness >= cool_threshold:
  23.         cool_emojis.append(emoji_name)
  24. print(f"{len(emojis)} emojis found in the text. The cool ones are:")
  25. for emoji in emojis:
  26.     if emoji[2] in cool_emojis:
  27.         print(emoji[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement