MariyanGrigorov

Problem 2 - Destination Mapper-falls

Jun 17th, 2024
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. input_string = input().split('/')
  2. new_list = []
  3. for i in input_string:
  4.     x = i.count('=')
  5.     if x == 2:
  6.         new_list.append(i)
  7.     elif x == i.count('='):
  8.         if x == 0:
  9.             new_list.append(i)
  10. new_list1 = []
  11. for leather in new_list:
  12.     if '=' in leather:
  13.         a = leather.replace('=','')
  14.         new_list1.append(a)
  15.     elif '=' not in leather:
  16.         a = leather
  17.         new_list1.append(a)
  18. word_list = []
  19. for word in new_list1:
  20.     if word.isalpha() and len(word) > 3 and str(word[0]).isupper():
  21.         word_list.append(word)
  22.  
  23. result = ', '.join(word_list)
  24. total_sum = sum(len(word_list)for word_list in word_list)
  25. print(f'Destinations: {result}')
  26. print(f'Travel Points: {total_sum}')
Advertisement
Add Comment
Please, Sign In to add comment