Skip to content
MathsGenie logo
Open app

Course home

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

Computational thinking

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
Question 51

An algorithm is designed to display a list of musical instruments available for a band workshop.

1      # ----- Global variables -----
2      bandInstruments = ["Guitar", "Bass", "Drums", "Keyboard"]
3
4      # ----- Subprograms -----
5      def showInstruments (itemList):
6          for i in range (0, len (itemList)):
7              print (i, itemList[i])
8
9      # ----- Main Program -----
10     response = input ("Do you want to see the instruments? ")
11     if ((response == "yes") or (response == "Yes")):
12         showInstruments (bandInstruments)
13     else:
14         print ("Goodbye")

State the type of data structure used to hold the band instruments inside the variable bandInstruments in this algorithm.

[1]

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking