Periodic table

Periodic table

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.

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.

Use this boilerplate code as a starting point:

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

Element: Potassium

Atomic weight: 39.098

Group: Alkali metals


Enter the symbol or name of an element: Clorine

Element: Chlorine

Atomic weight: 35.45

Group: Halogens

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:

Evaluate


Run the unit tests below to check that your program has met the success criteria.

Enter the symbol or name of an element: K

Element: Potassium

Atomic weight: 39.098

Group: Alkali metals

Enter the symbol or name of an element: Clorine

Element: Chlorine

Atomic weight: 35.45

Group: Halogens

Check that you have:

  • Used comments within the code to describe the purpose of subprograms and conditions.
  • Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.
Craig'n'Dave logo

Craig ‘n’ Dave

Bett Awards 2024 Finalist