Question: # Write a program to modify the email addresses in the records dictionary to reflect this change
records = {57394: ['Suresh Datta', '[email protected]'], 48539: ['ColetteBrowning', '[email protected]'], 58302: ['Skye Homsi','[email protected]'], 48502: ['Hiroto Yamaguchi', '[email protected]'], 48291: ['Tobias Ledford', '[email protected]'], 48293: ['Jin Xu', '[email protected]'], 23945: ['Joana Dias', '[email protected]'], 85823: ['Alton Derosa', '[email protected]']}
I have iterated through the dictionary and created a new list with the values and split the email at @ and was able to change the the email from .com to .org.
My approach was to join the changed email and change the values of the dictionary. However, I keep on getting a TypeError: sequence item 0: expected str instance, list found
my code :
lst2 = []
for value in records.values():
lst2.append(value[1].split('@'))
for items in lst2:
items[1] = 'examples.org'
for items in lst2:
','.join(lst2)
','.join(lst2),lst2is two-dimensional array