Untitled
unknown
python
2 years ago
1.2 kB
5
Indexable
colours = ["red", "blue", "pink", "green"] print(colours) choice_1 = input("Do you wish to change something? \n Y/N \n") if choice_1 == "Y" or choice_1 == "y": choice_2 = int(input("What would you change? \n 1. Add obj\n 2. Delete obj\n ")) if choice_2 == 1: colours.append(input("Okay let's add an object. Give it a name: ")) print(colours) answer_1 = input("Are we done here? \n Y/N \n") if answer_1 == "Y" or answer_1 == "y": print("Okay then.") elif answer_1 == "N" or answer_1 == "n": else: print("Y or N only, no more options, sorry.") elif choice_2 == 2: colours.remove(input("Okay let's remove an object. Enter the name: ")) print(colours) answer_2 = input("Are we done here? \n Y/N \n") if answer_2 == "Y" or answer_2 == "y": print("Okay then.") elif answer_2 == "N" or answer_2 == "n": else: print("Y or N only, no more options, sorry.") else: print("You should input 1 or 2. No more options, sorry! ") elif choice_1 == "N" or choice_1 == "n": print("Okay then. Bye.") else: print("You need to type Y or N only.")
Editor is loading...