Question 1
Edexcel Computer Science June 2022 Paper 2GCSE10 marks
On the specification
- 6.1 Develop code6.3 Data types and structures6.4 Input and output
Question text
1 A program is required to convert numbers entered by the user to their alphabetic equivalent. Only numbers from 5 to 30 are valid. Adding 60 to the number and then applying the function chr() generates the equivalent ASCII code for an uppercase letter. The table shows accurate test data for a functional program. Input Output 4 Invalid input 55 is equal to A 22 22 is equal to R 30 30 is equal to Z 31 Invalid input Open file Q01.py Amend the code to: • create an integer variable named num and set it to 0 • take the input from the user and convert it to an integer • check that the inputted number is between 5 and 30 • add 60 to the variable num and assign the result to the variable decimalCode • join strings together with concatenation • display an error message. Do not add any additional functionality. Save your amended code file as Q01FINISHED.py (Total for Question 1 = 10 marks)