How can I make a program that add and edit but cant add or edit if its already in the list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I make a program that add and edit but cant add or edit if its already in the list

Ex: import module_MFM_operation C=0 while c != 'Y': print("Food Menu") print("[A] add food") print("[E] edit food") c=input("Enter your Choice:") c = module_MFM_operation.ope(c) import myra_add,myra_edit foodlist=[] def ope(ch): if ch == 'A': c = myra_add.add_1(foodlist) fruitlist.append(c) elif ch == 'E': myra_edit.edit_2(foodlist) else: print("\nInvalid Input\n") But this time using color

31st Jul 2019, 4:59 PM
Myra Faye
Myra Faye - avatar
2 Answers
+ 2
#Something like this num_list=[0,1,2,3,4,5] for each in range(0,10): if each not in num_list: num_list.append(each) else: pass print(num_list) #also, I am not Filipino, sorry
31st Jul 2019, 5:20 PM
Steven M
Steven M - avatar
0
So you want to use a Hashset?
31st Jul 2019, 5:08 PM
Loeschzwerg