0% found this document useful (0 votes)
29 views1 page

Atomic Elements

Uploaded by

Suyash Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views1 page

Atomic Elements

Uploaded by

Suyash Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

# Dictionary of the first 30 elements with their atomic details

elements = {
1: {"name": "Hydrogen", "symbol": "H", "atomic_mass": 1.008},
2: {"name": "Helium", "symbol": "He", "atomic_mass": 4.0026},
3: {"name": "Lithium", "symbol": "Li", "atomic_mass": 6.94},
4: {"name": "Beryllium", "symbol": "Be", "atomic_mass": 9.0122},
5: {"name": "Boron", "symbol": "B", "atomic_mass": 10.81},
6: {"name": "Carbon", "symbol": "C", "atomic_mass": 12.011},
7: {"name": "Nitrogen", "symbol": "N", "atomic_mass": 14.007},
8: {"name": "Oxygen", "symbol": "O", "atomic_mass": 15.999},
9: {"name": "Fluorine", "symbol": "F", "atomic_mass": 18.998},
10: {"name": "Neon", "symbol": "Ne", "atomic_mass": 20.180},
11: {"name": "Sodium", "symbol": "Na", "atomic_mass": 22.990},
12: {"name": "Magnesium", "symbol": "Mg", "atomic_mass": 24.305},
13: {"name": "Aluminum", "symbol": "Al", "atomic_mass": 26.982},
14: {"name": "Silicon", "symbol": "Si", "atomic_mass": 28.085},
15: {"name": "Phosphorus", "symbol": "P", "atomic_mass": 30.974},
16: {"name": "Sulfur", "symbol": "S", "atomic_mass": 32.06},
17: {"name": "Chlorine", "symbol": "Cl", "atomic_mass": 35.45},
18: {"name": "Argon", "symbol": "Ar", "atomic_mass": 39.948},
19: {"name": "Potassium", "symbol": "K", "atomic_mass": 39.098},
20: {"name": "Calcium", "symbol": "Ca", "atomic_mass": 40.078},
21: {"name": "Scandium", "symbol": "Sc", "atomic_mass": 44.956},
22: {"name": "Titanium", "symbol": "Ti", "atomic_mass": 47.867},
23: {"name": "Vanadium", "symbol": "V", "atomic_mass": 50.942},
24: {"name": "Chromium", "symbol": "Cr", "atomic_mass": 52.037},
25: {"name": "Manganese", "symbol": "Mn", "atomic_mass": 54.938},
26: {"name": "Iron", "symbol": "Fe", "atomic_mass": 55.845},
27: {"name": "Cobalt", "symbol": "Co", "atomic_mass": 58.933},
28: {"name": "Nickel", "symbol": "Ni", "atomic_mass": 58.693},
29: {"name": "Copper", "symbol": "Cu", "atomic_mass": 63.546},
30: {"name": "Zinc", "symbol": "Zn", "atomic_mass": 65.38}
}

# Get input from the user


user_input = input("Enter the name or symbol of an element: ")

# Convert user input to uppercase to handle case insensitivity


user_input = user_input.capitalize()

# Search for the element in the dictionary


found = False
for atomic_number, element in [Link]():
if user_input == element['name'] or user_input == element['symbol']:
# If the element is found, print its atomic number, name, symbol, and
atomic mass
print(f"Element: {element['name']}")
print(f"Atomic Number: {atomic_number}")
print(f"Symbol: {element['symbol']}")
print(f"Atomic Mass: {element['atomic_mass']}")
found = True
break

if not found:
print("Element not found. Please check the name or symbol and try again.")

You might also like