I have a list of things like this:
My_list = [['A1'],['B2'],['C3']]
I am asking the user to enter a LETTER (only) indicating which element to delete. So, for example, if the user entered 'B', the 2nd entry should be deleted and the list should look like this:
My_list = [['A1'],['C3']]
I have tried several solutions, but below is my best attempt at this...and i believe i'm not too far away from the final answer.
My_list = [['A1','B2','C3']]
print('What LETTER pairing would you like to delete?')
get_letter = input()
delete_letter = get_letter.upper()
for each_element in My_list:
for each_pair in each_element:
if each_pair[0] == delete_letter:
location = My_list.index(each_pair)
clues_list.pop(location)
print('done')
when i run and enter 'B' the Compile error says...
ValueError: 'B2' is not in list
...but B2 is in list!
Where am i going wrong?