Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- text = input()
- threshold_pattern = r'\d'
- threshold_match = re.findall(threshold_pattern, text)
- result = 0
- for i in threshold_match:
- if result == 0:
- result += int(i)
- else:
- if int(i) != 0:
- result *= int(i)
- print(f'Cool threshold: {result}')
- pattern = r'([*|:]{2})([A-Z][a-z]{2,})(\1)'
- matches = re.findall(pattern, text)
- print(f'{len(matches)} emojis found in the text. The cool ones are:')
- for j in matches:
- coolness = 0
- emoji_text = j[1]
- for x in emoji_text:
- coolness += ord(x)
- if coolness >= result:
- print(f'{j[0]}{j[1]}{j[2]}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement