Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- text = input()
- pattern = r"(::|\*\*)([A-Z][a-z]{2,})\1"
- threshold = 1
- coolness = 0
- counter = 0
- cool_emojis = []
- digits_match = re.findall(r"\d", text)
- for digit in digits_match:
- threshold *= int(digit)
- emoji_matches = re.finditer(pattern, text)
- for emoji in emoji_matches:
- counter += 1
- coolness = sum([ord(s) for s in emoji.group(2)])
- if coolness > threshold:
- cool_emojis.append(emoji.group(0))
- print(f"Cool threshold: {threshold}")
- print(f"{counter} emojis found in the text. The cool ones are:")
- print('\n'.join(cool_emojis))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement