Question 6
Edexcel Computer Science June 2024 Paper 2GCSE15 marks
On the specification
- 6.3 Data types and structures6.4 Input and output6.5 Operators
Question text
6 A program is required to process data about cows. The data is stored in a comma separated value text file named Cows.txt The columns in the data file are: • name • breed • tag number. Open file Q06.py Write a program to meet these requirements: • create a key for each cow in the data. A valid key is a single string consisting of (in this order) – the first two letters of the breed name – the tag number integer divided by 100 – the first two letters of the cow’s name • create a record for each cow. A valid record consists of (in this order) – a key, a tag number, a name and a breed • store the record for each cow in the cowTable • call the supplied subprogram, showTable(), to display the contents of the cowTable • the program must work with any number of lines in the data file. 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)