Masala #LP0ORMQS0Z
Science
Write a program that generates a series of element information problems. Each problem consists of an atomic number of an element, ranging from 1 to 20.
Your task is to provide information about the element corresponding to the given atomic number. The information includes the element's symbol, name, and classification (whether it is a metal or non-metal).
Write a Python program that generates 20 element information problems
The input file should contain a single line with the atomic number of the element.
The output file should contain a single line with the element's information in the format symbol:name:classification
, where symbol
is the chemical symbol of the element, name
is the name of the element, and classification
indicates whether it is a metal or non-metal.
# | input.txt | output.txt |
---|---|---|
1 |
15 |
P:Phosphorus:non-metal |
2 |
4 |
Be:Berrylium:metal |
Use the following mappings for atomic number and element information:
1: H: Hydrogen: non-metal
2: He: Helium: non-metal
3: Li: Lithium: metal
4: Be: Beryllium: metal
5: B: Boron: non-metal
6: C: Carbon: non-metal
7: N: Nitrogen: non-metal
8: O: Oxygen: non-metal
9: F: Fluorine: non-metal
10: Ne: Neon: non-metal
11: Na: Sodium: metal
12: Mg: Magnesium: metal
13: Al: Aluminium: non-metal
14: Si: Silicon: non-metal
15: P: Phosphorus: non-metal
16: S: Sulfur: non-metal
17: Cl: Chlorine: non-metal
18: Ar: Argon: non-metal
19: K: Potassium: metal
20: Ca: Calcium: metal