I am new to coding and having trouble solving an issue. I found some code online regarding this subject but it did not work how I would like it to.
Let's say I have 3 abbreviated NBA teams in a list: LAL, LAC and MIL. I would, however, like the full NBA teams to be printed: Lakers, Clippers, Bucks.
Here is my code so far:
my_list=["LAL", "LAC", "MIL"]
my_dict={"HOU":"Rockets", "LAC":"Clippers", "LAL":"Lakers", "MIL": "Bucks", "BOS": "Celtics"}
for e in my_list:
if e in my_dict:
print(my_dict[e])
break
Here is my current output:
Lakers
Here is my desired output:
Lakers, Clippers, Bucks
Basically I would like to find out if any of the keys in the list are present. If they are, I would like to print all of the values of the keys that are in the list.
Thanks in advance for your time and assistance. I am very grateful for any help that anyone may offer.