Reputation: 1
accounts = [["Tom", "Boyle", "23"]]
for meta in "First Name", "Last Name", "Age":
for account in accounts:
# The line below is what I have trouble with
for info, meta in account, ("First Name", "Last Name", "Age"):
print(meta + ": " + info)
print("------------------------------------------")
""" Expected Output:
First Name: Tom
Last Lame: Boyle
Age: 23
------------------------------------------
"""
Upvotes: 0
Views: 38
Reputation: 12711
I think what you're looking for is:
accounts = [["Tom", "Boyle", "23"]]
meta_list = ["First Name", "Last Name", "Age"]
for account in accounts:
for meta, info in zip(meta_list,account):
print(meta + ": " + info)
print("------------------------------------------")
Upvotes: 1