So I have a dictionary
services = {
"Waste Removal": 12.98,
"Coffee Subscription": 32.99,
"Lawn Mowing": 16.98,
"Magazine Subscription": 21.98,
"Cable TV": 23.98,
"Music Subscription": 18.98,
}
I converted the dictionary into a list using services_list = list(Catalogue.services.keys())
I am then trying to remove elements from the list based on user input (Y/N). But the program is removing every element from the list and prints out the list line by line. Current output
# Convert dictionary to a list.
services_list = list(Catalogue.services.keys())
# prompt for input
for i in services_list:
opt = input("Opt out of " + i + " (Y/N) : ")
if opt == "Y" or "y":
services_list.remove(i)
print(services_list)
This is what I am trying to achieve: expected output