HW4Q4

 avatar
user_7676782
python
2 years ago
565 B
2
Indexable
Never
# nested dictionary for symbol
symbols = {"H": {'Name': 'Hydrogen', 'Atoms': '1', 'Mass': '1.0078'},
           "He": {'Name': 'Helium', 'Atoms': '2', 'Mass': '4.0026'},
           "Li": {'Name': 'Lithium', 'Atoms0': '3', 'Mass': '6.9410'},
           "Be": {'Name': 'Beryllium', 'Atoms': '4', 'Mass': '9.0122'},
           "B": {'Name': 'Boron', 'Atoms': '5', 'Mass': '10.811'}}

# get the input form user
mySymbol= input("Enter symbol: ")
# find the user symbol request and print
for key in symbols:
    if mySymbol == key:
        print(symbols[key])