items = {
} #dishnery
while True: #to constantly run the loop
print("To add an item : add")
print("To remove an item : remove")
print(" To see the list of items : list")
print("To exit the program : exit")
print()
choice = input("Enter your choice : ").title() #choice input
print()
print("_"* 160)
print()
if choice == "Add": #to add items in list
item_name = input("Enter item name: ").title() #input for item name
if item_name.isalpha():
items[item_name] = item_name
print()
print(f"The item {item_name} has been added to the list ")
print()
print("_"* 160)
print()
else :
print()
print(f"{item_name} this name is not valid item")
break
elif choice == "Remove": # to remove item
item_name = input("Enter item name you want to Remove: ").title()
if item_name.isalpha():
items.pop(item_name)
print()
print(f"The item {item_name} has been removed from the list ")
print()
print("_"* 160)
else:
print()
print(f"{item_name} is not present in the list name")
break
elif choice == "List": #to show item list
for item in items:
print("All items in your list : ")
print()
print("_"* 160)
print()
print(item)
print()
print("_"* 160)
break
elif choice == "Exit": #for exit
print()
print("Goodbye")
break
else: #if choice is invalid show
print("Invalid choice enter valid choice")
print()
print("_"* 160)
Be the first to spread love with your comment on this post!