A student has written an algorithm to manage age-based discounts for a cinema.
1 # -----
2 # Global variables
3 # -----
4 ticketPrices = [12, 15, 18, 25]
5 age = 0
6
7 # -----
8 # Main program
9 # -----
10
11 for price in ticketPrices:
12 print ("Price options: " + str(price))
13
14 age = int(input ("Enter subscriber age: "))
15 while (age > 0):
16 if (age < 16):
17 print ("Child discount applies")
18 else:
19 print ("Standard rate applies")
20
21 age = int(input ("Enter subscriber age: "))
Give the line numbers where selection is used in this algorithm.
50 exam-style questions on Edexcel GCSE Computer Science Constructs, covering Structural components of programs and Writing programs with control constructs. Each one has a worked solution and a mark scheme showing where the marks go.