Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shoping_list = input().split("!")
- while True:
- command = input()
- if command == 'Go Shopping!':
- break
- new_commands = command.split()
- action = new_commands[0]
- item_one = new_commands[1]
- if action == 'Correct':
- item_two = new_commands[2]
- if item_one in shoping_list:
- shoping_list = list(map(lambda x: x.replace(item_one, item_two), shoping_list))
- else:
- continue
- elif action == 'Urgent':
- if item_one not in shoping_list:
- shoping_list.insert(item_one, 0)
- else:
- continue
- elif action == 'Unnecessary':
- if item_one in shoping_list:
- shoping_list.remove(item_one)
- else:
- continue
- elif action == 'Rearrange':
- if item_one in shoping_list:
- shoping_list.remove(item_one)
- shoping_list.append(item_one)
- print(", ".join(shoping_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement