-3

How do slice a list within a lists ?

periodic_table_list = [["Ac", "Actinium", 227],["Ag", "Silver", 107.8682],["Al", "Aluminum", 26.9815386]]

I want store Code in one variable, Name in one variable and then the figure in another variable.

#Thnx guys i finally figured it out
#create indexes of element in the inner lists code = 0
name = 1
mass = 2
periodic_table_list = [["Ac", "Actinium", 227],["Ag", "Silver", 107.8682],["Al", "Aluminum", 26.9815386]]
for inner_list in periodic_table_list :
element_name = inner_lists [1]
print (f"{element_name}"

0 Answers0