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