Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 9 70 -56 9 9
- nums = list(map(int, input().split(" ")))
- command = input().split()
- value = int(command[1])
- replacement = int(command[2])
- counter = 0
- for i in range(len(nums)):
- if command[0] == "Replace":
- if nums[i] == value:
- nums.remove(value)
- nums.insert(i, replacement)
- counter += 1
- if counter >= 1:
- break
- print(nums)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement