Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numbers = list(map(int, input().split()))
- command = input()
- while command != 'end':
- command_list = command.split()
- action = command_list[0]
- if action == 'swap':
- swap_one = int(command_list[1])
- swap_two = int(command_list[2])
- numbers[swap_one], numbers[swap_two] = numbers[swap_two], numbers[swap_one]
- elif action == 'multiply':
- multiplier_one = int(numbers[int(command_list[1])])
- multiplier_two = int(numbers[int(command_list[2])])
- multiplication = multiplier_one * multiplier_two
- numbers[int(command_list[1])] = multiplication
- elif command == 'decrease':
- for pos in range(len(numbers)):
- numbers[pos] -= 1
- command = input()
- final_list = [str(i) for i in numbers]
- print(', '.join(final_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement