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