Question 6
Edexcel Computer Science Specimen Paper 2GCSE15 marks
On the specification
- 1.2 Algorithms6.3 Data types and structures6.4 Input and output
Question text
6 A program is needed to authenticate system logins consisting of a login name and a four-digit passcode. These items for current users are stored in a two-dimensional list with 19 records. The list contains user number, last name, first name, login name and passcode. The list is sorted by login name. All users have passcodes that are integers between 1000 and 9999. S67286A Open file Q06. Write a program to meet the following requirements: Inputs • Prompt for and accept a login name, no validation required • Prompt for and accept a four-digit passcode. You can assume only numbers will be entered • Ensure the passcode is between 1000 and 9999, inclusive Process • Work with any number of users in the list • Use a linear search to find the record with the correct combination of login name and passcode • Stop searching when the location of where the record should have been found is passed. For example: – if looking for ‘Jam118’ and find ‘Joy116’, then the record is not in the list, so the search can stop • Does not need to loop continuously Outputs • Display a welcome message, including the user’s first and last names, if the login name and passcode are found • Display an invalid input message, if the login name and passcode are not found. Do not add any additional functionality. Use comments, white space and layout to make the program easier to read and understand. Save your amended code as Q06FINISHED.py (Total for Question 6 = 15 marks)