Find an element in the periodic table.

In 1869 Russian chemist Dimitri Mendeleev started the development of the periodic table, arranging chemical elements by atomic mass. He predicted the discovery of other elements, and left spaces open in his periodic table for them.

Periodic table

⭐⭐⭐

Make

Write a program that allows the user to enter the symbol or name of an element. The program outputs the name of the element, the atomic weight and the group of elements it belongs to using the data in the table below.

Success Criteria

Remember to add a comment before a subprogram or selection statement to explain its purpose.

Create a subprogram called periodic_table that:

  1. Takes a parameter that is the symbol or name of an element in the periodic table. E.g. Li is Lithium.
  2. Ouputs the symbol of the element.
  3. Outputs the name of the element.
  4. Outputs the atomic weight of the element.
  5. Outputs the group the element belongs to.
  6. Ouputs “Element is not in the catalogue.” if the data is not in the program.
  7. Uses the data below for the subprogram:
Symbol Element Atomic weight Group
Li Lithium 6.94 Alkali metals
Na Sodium 22.99 Alkali metals
K Potassium 39.098 Alkali metals
F Fluorine 18.998 Halogens
Cl Chlorine 35.45 Halogens
Br Bromine 79.904 Halogens

Complete the main program so that:

  1. The user can input the symbol or name of an element.
  2. It calls the periodic_table subprogram to output the relevant data.

Typical inputs and outputs from the program would be:

Enter the symbol or name of an element: K
Symbol: K
Element: Potassium
Atomic weight: 39.098
Group: Alkali metals
Enter the symbol or name of an element: Chlorine
Symbol: Cl
Element: Chlorine
Atomic weight: 35.45
Group: Halogens
Parsons editor: complete program