Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # You will receive how many wagons the train has.
- # Until you receive "End", you get some of the commands:
- # add {people} -> adds the people in the last wagon
- # insert {index} {people} -> adds the people at the given wagon
- # leave {index} {people} -> removes the people from the wagon
- #
- # Input:
- # 3
- # add 20
- # insert 0 15
- # leave 0 5
- # End
- #
- # Output:
- # [10, 0, 20]
- command = input()
- temp_list = [0] * 10
- results_list = []
- while not command == 'End':
- task_parts = command.split("-")
- priority = int(task_parts[0])
- note = task_parts[1]
- temp_list.insert(priority, note)
- command = input()
- for each_item in temp_list:
- if not each_item == 0:
- results_list.append(each_item)
- print(results_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement