Question 6

Edexcel Computer Science June 2022 Paper 2GCSE15 marks

On the specification

1.2 Algorithms6.2 Program constructs6.3 Data types and structures
Question text

6 In a board game, users build words from letter tiles. Each letter tile has a points value. There are 107 valid two-letter words. A program is required to check that each two-letter word placed on the board is valid. Each valid two-letter word with its points value is stored as a record in the two-dimensional list, wordTable. The records are stored in alphabetical order. Open file Q06.py Write a program to meet these requirements: Inputs • prompt for and accept a two-letter word from the user, AA to ZZ, inclusive • accept uppercase and lowercase input • no other validation is required. Process • create a linear search to locate the word in wordTable • stop the search when: • the word is located • the expected location of the user’s word is passed • the end of the list is reached after all words have been checked • ensure the search works for any length of wordTable Outputs • when the user’s word is located, inform the user of the word and the number of points it scores • when the expected location of the user’s word is passed, suggest the next word and the number of points it scores • when the end of the list is reached after all words have been checked, suggest the last word in the list and the number of points it scores. Use comments, white space and layout to make the program easier to read and understand. Do not add any additional functionality. Save your amended code as Q06FINISHED.py (Total for Question 6 = 15 marks)