Say I have an address book filled with 30 addresses and no names associated with them. I want to find out who lives where, so I've also obtained the yellow pages which should have these addresses and the associated names of each resident.
Translate this into Python (3+), how can I find the names in the yellow pages and associate them with my 30 addresses into a new list that returns both the name and address?
I'm struggling to find the best way to think programmatically about this, so any help would be greatly appreciated.
I tried variants of the following, but I am only getting one name associated with all the addresses, which I know is incorrect:
for name in yellowPages:
for address in addressBook:
if address == address in specificPage:
print(name, "'s address is: " + address)
Aucun commentaire:
Enregistrer un commentaire