Advertisement
DiYane

Destination mapper

Sep 16th, 2023
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import re
  2.  
  3. regex = r"([=|/])([A-Z][A-Za-z]{2,})\1"
  4.  
  5. data = re.findall(regex, input())
  6.  
  7. destinations = []
  8. travel_points = 0
  9. for match in data:
  10.     destinations.append(match[1])
  11.     travel_points += len(match[1])
  12.  
  13. print(f'Destinations: {", ".join([x for x in destinations])}')
  14. print(f'Travel Points: {travel_points}')
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement