Question 3

AQA Computer Science June 2022 Paper 1B (8525/1B)GCSE2 marks

On the specification

3.1
3.2 Programming
3.2
3.2 Programming
Question text

3 box Figure 4 shows a Python program that calculates car park charges. The user inputs their car registration (eg MA19 GHJ) and the length of the stay. The program then outputs the charge. • Line numbers are included but are not part of the program. Figure 4 1 charge = 0 2 carReg = input("Enter your car registration: ") 3 while len(carReg) > 8: 4 displayMessage = " is not valid" 5 carReg = input(displayMessage) 6 hours = int(input("Enter your stay in hours: ")) 7 if hours < 2: 8 charge = 0 9 else: 10 charge = hours * 2 11 print(charge) 3.1 Rewrite line 4 in Figure 4 to concatenate the car registration with the string " is not valid", and store the result in the variable displayMessage. Your answer must be written in Python. [1 mark] 3.2 The charge for parking for two or more hours is changed to include an additional £2 fee. Rewrite line 10 in Figure 4 to show this change. Your answer must be written in Python. [1 mark]