Question 2
Edexcel Computer Science June 2024 Paper 2GCSE10 marks
On the specification
- 6.1 Develop code6.3 Data types and structures6.5 Operators
Question text
2 P75441RA Suggested time: 15 minutes 2 A program encrypts a message using a Caesar cipher. The letters of the alphabet are shifted a set number of places. A positive shift moves the letters to the right. A negative shift moves them to the left. Blanks, symbols and numbers are not encrypted. When the end of the alphabet is reached with a positive shift, shifting continues at the start of the alphabet. When the start of the alphabet is reached with a negative shift, shifting continues at the end of the alphabet. For example, a shift of −2 encodes the plaintext letter P to the ciphertext letter N. A shift of +4 encodes the plaintext letter X to the ciphertext letter B. When working correctly, the program produces the encrypted ciphertext for these plaintext messages and shift inputs. Plaintext Shift Ciphertext The Rainbow 4 Xli Vemrfsa Alphabet Soup −5 Vgkcvwzo Njpk 123 ^&* Bye 9 123 ^&* Khn Open file Q02.py Amend the code to make the program work and produce the correct output. You will need to: • choose between alternative lines of code. Make a choice by removing the # at the beginning of the line you choose to execute • run the program with the data from the table and check it meets the requirements. Do not change the functionality of the given lines of code. Do not add any additional functionality. Save your amended code as Q02FINISHED.py (Total for Question 2 = 10 marks)