Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- text = input()
- digits = [int(digit) for digit in re.findall(r"\d", text)]
- cool_threshold = 1
- if digits:
- for digit in digits:
- cool_threshold *= digit
- else:
- cool_threshold = 0
- print(f"Cool threshold: {cool_threshold}")
- emojis = re.findall(r"((:{2}|\*{2})([A-Z][a-z]{2,})\2)", text)
- # emojis = re.findall(r"(:{2}|\*{2})([A-Z][a-z]{2,})\1", text)
- cool_emojis = []
- for emoji in emojis:
- emoji_name = emoji[2]
- emoji_coolness = sum(ord(char) for char in emoji_name)
- if emoji_coolness >= cool_threshold:
- cool_emojis.append(emoji_name)
- print(f"{len(emojis)} emojis found in the text. The cool ones are:")
- for emoji in emojis:
- if emoji[2] in cool_emojis:
- print(emoji[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement