Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import re
  2.  
  3. text = input()
  4.  
  5. threshold_pattern = r'\d'
  6.  
  7. threshold_match = re.findall(threshold_pattern, text)
  8.  
  9. result = 0
  10. for i in threshold_match:
  11.     if result == 0:
  12.         result += int(i)
  13.     else:
  14.         if int(i) != 0:
  15.             result *= int(i)
  16.  
  17. print(f'Cool threshold: {result}')
  18.  
  19. pattern = r'([*|:]{2})([A-Z][a-z]{2,})(\1)'
  20.  
  21. matches = re.findall(pattern, text)
  22.  
  23. print(f'{len(matches)} emojis found in the text. The cool ones are:')
  24.  
  25. for j in matches:
  26.     coolness = 0
  27.     emoji_text = j[1]
  28.     for x in emoji_text:
  29.         coolness += ord(x)
  30.     if coolness >= result:
  31.         print(f'{j[0]}{j[1]}{j[2]}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement