Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- biscuits = input().split(', ')
- command = input()
- while command != 'Eat':
- current_command = command.split()
- if current_command[0] == 'Update-Any':
- if current_command[1] in biscuits:
- for i in range(len(biscuits)):
- if biscuits[i] == current_command[1]:
- biscuits[i] = "Out of stock"
- elif current_command[0] == 'Remove':
- if 0 <= int(current_command[2]) < len(biscuits):
- biscuits[int(current_command[2])] = current_command[1]
- elif current_command[0] == 'Update-Last':
- biscuits[len(biscuits) - 1] = current_command[1]
- elif current_command[0] == 'Rearrange':
- if current_command[1] in biscuits:
- for i in range(len(biscuits)):
- if biscuits[i] == current_command[1]:
- biscuits.pop(i)
- biscuits.append(current_command[1])
- command = input()
- biscuits = [el for el in biscuits if "Out of stock" not in el]
- print(' '.join(biscuits))
Add Comment
Please, Sign In to add comment