Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stops = input()
- line = input()
- while not line == 'Travel':
- line = line.split(':')
- command = line[0]
- if command == 'Add Stop':
- index = int(line[1])
- destination = line[2]
- if 0 <= index < len(stops):
- stops = stops[:index] + destination + stops[index:]
- elif command == 'Remove Stop':
- start_index = int(line[1])
- end_index = int(line[2])
- if 0 <= start_index < len(stops) and 0 <= end_index < len(stops):
- stops = stops[:start_index] + stops[end_index+1:]
- elif command == 'Switch':
- old_string = line[1]
- new_string = line[2]
- if old_string in stops:
- stops = stops.replace(old_string, new_string)
- print(stops)
- line = input()
- print(f'Ready for world tour! Planned stops: {stops}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement