Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Develop code

EasyMediumHard
123456789101112
Question 10

A program contains a 2-dimensional data structure named theAstronauts which stores the first name, last name, and year of selection for a group of astronauts.

An example of the data structure is shown below:

theAstronauts = [
    ["Helen", "Sharman", 1989],
    ["Yuri", "Gagarin", 1960],
    ["Mae", "Jemison", 1987],
    ["Tim", "Peake", 2009],
    ["Sally", "Ride", 1978]
]
theLabels = []

Mission badges require a unique label to be generated for each astronaut. The label is created by joining:

  1. The first letter of their last name.
  2. The first letter of their first name.
  3. Their year of selection.

For example, the label for ["Helen", "Sharman", 1989] would be "SH1989".

Write a program in Python or a standard pseudocode to:

  • Process each astronaut in theAstronauts to generate their unique label.
  • Store all generated labels in the 1-dimensional data structure named theLabels.
  • Display all the generated labels.
  • Find and display the first name, last name, and selection year of the most recently selected astronaut (the one with the largest selection year value).

Your program must function correctly even if theAstronauts contains a different number of records or different data.

[20]

Develop code Questions

  1. IGCSE
  2. /Computer Science
  3. /Develop code