Hi,
I've created this code, whereby, if i type "quit", it will return "Goodbye" but in this case, it returns twice. Any hint on how do I make it to return once?
Below is the whole code:
Thanks I guess I figured it out
I've created this code, whereby, if i type "quit", it will return "Goodbye" but in this case, it returns twice. Any hint on how do I make it to return once?
Below is the whole code:
animals = ["cat","goat","cat"] def list_o_matic(choice): if choice in animals: animals.remove(choice) print(animals) elif choice == "": animals.pop(0) print(animals) elif choice != animals: animals.append(choice) print(animals) while True: if len(animals) < 0: print("Goodbye!!") else: choice = input("Enter animal [cat, goat, cat or others]: ") if choice == "quit": print("Goodbye!") break else: list_o_matic(choice)Thanks
Thanks I guess I figured it out