Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
178
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. pattern = r"(([:|*]{2})[A-Z][a-z]{2,}\2)"
  4.  
  5. text = input()
  6. cool_threshold = 1
  7.  
  8. for char in text:
  9.     if char.isdigit():
  10.         cool_threshold *= int(char)
  11.  
  12. emojis = [groups[0] for groups in re.findall(pattern, text)]
  13.  
  14. print(f"Cool threshold: {cool_threshold}")
  15. print(f"{len(emojis)} emojis found in the text. The cool ones are:")
  16.  
  17. for emoji in emojis:
  18.     coolness = sum([ord(char) for char in emoji if char != ":" and char != "*"])
  19.     if coolness > cool_threshold:
  20.         print(emoji)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement