Advertisement
go6odn28

emoji_decorator_

Mar 26th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 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. cool_emojis = []
  17.  
  18. for emoji in emojis:
  19.     emoji_name = emoji[2]
  20.     emoji_coolness = sum(ord(char) for char in emoji_name)
  21.     if emoji_coolness >= cool_threshold:
  22.         cool_emojis.append(emoji_name)
  23. print(f"{len(emojis)} emojis found in the text. The cool ones are:")
  24. for emoji in emojis:
  25.     if emoji[2] in cool_emojis:
  26.         print(emoji[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement