Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- destinations = input()
- valid_destinations = list()
- def extract_destinations():
- return destinations.split('=') + destinations.split('/')
- def validate_destinations(destinations_lst):
- for destination in destinations_lst:
- if str(destination[:]).isalpha() \
- and str(destination[0]) == str(destination[0]).upper() \
- and len(destination) >= 3:
- valid_destinations.append(destination)
- def calculate_travel_points():
- points = 0
- for destination in valid_destinations:
- points += len(destination)
- return points
- extracted_destinations = extract_destinations()
- validate_destinations(extracted_destinations)
- travel_points = calculate_travel_points()
- print(f"Destinations: {', '.join(valid_destinations)}")
- print(f"Travel Points: {travel_points}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement