Я хочу преобразовать этот 2D-список в словарь. В одном из подсписок нет второго элемента, и я хочу, чтобы мой словарь пересмотрел это, вернув «Нет»
contact_dictionary = {}
contact_list = []
def user_contact(dictionary,contact_list):
for contact in contact_list:
name = contact[0]
#here is where my loop is disrupted because I cant figure out how to avoid an IndexError for Bethany
address = contact[1]
contact_dictionary[name] = address
return contact_dictionary
user_contact(contact_dictionary,[["Grae Drake", 98110], ["Alex Nussbacher", 94101], ["Bethany Kok"], ["Darrell Silver", 11201]])```