Advertisement
Guest User

02.Emoji

a guest
Apr 4th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import re
  2. valid = []
  3. delimiter = []
  4. text = input()
  5. pattern = r"(::|\*\*)([A-Z][a-z]{2,})\1"
  6. s = re.findall(pattern,text)
  7. for i in s:
  8.     valid.append(i)
  9.  
  10. coolness= [int(i) for i in text if i.isdigit()]
  11. coolness_result = 1
  12. for x in coolness:
  13.          coolness_result = coolness_result * x
  14.  
  15. int_valid=[]
  16. for string in valid:
  17.     if (sum([ord(i) for i in string[1]]))>=coolness_result:
  18.         int_valid.append(string)
  19.  
  20. print (f"Cool threshold: {coolness_result}")
  21. print (f"{len(valid)} emojis found in the text. The cool ones are:")
  22. for i in int_valid:
  23.     print (f"{i[0]}{i[1]}{i[0]}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement