70. Inventory 1

Time Limit: 1 seconds

Memory Limit: 1024 MB

Rating: 900

Problem Statement

Write a program that first accepts your list of items, then shows you what you have in your inventory. It should also be able to let you edit and add items or remove them based on a single character input $n$. It should check if the mentioned item is in the inventory before removing it. Print the original inventory before any changes. Once the user exists editing, print the final inventory. Possible choices: A - add to your inventory R - remove items from your inventory X - exit editing

Input

1st input: a list of items separated by a comma 2nd to nth input: a single character. If input = A or V, +1 input x, a single string containing an item $2 ≤ n ≤ 100$ $0 \le |list| \le 100$

Output

First line: The original list of items without any changes Second line: A list with the changes made (if any)

Sample Cases
Sample Input 0:
food,clothes,hygiene products,sleeping bags
A
toothbrush
X


Sample Output 0:
['food', 'clothes', 'hygiene products', 'sleeping bags']
['food', 'clothes', 'hygiene products', 'sleeping bags', 'toothbrush']
Explanation

Not available for this problem.

Sources

KL Coding Cup October 2024 > Problem 8

Submit | Back