Algorithms

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
Question 46
Easy

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]

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms