10Hard
0/15

A program is required to process data about fleet vehicles. The data is stored in a comma-separated value text file named Vehicles.txt

The columns in the data file are:

  • make
  • model
  • year

Open file Q06.py and write a program to meet these requirements:

  • Create a primary key for each vehicle. A valid key is a single string consisting of (in this order):
    • The first two letters of the make name
    • The year integer divided by 10 (using integer division)
    • The first three letters of the model name
  • Create a record for each vehicle. A valid record consists of (in this order):
    • The generated key, the year (as an integer), the make and the model
  • Store the record for each vehicle in a 2D list named vehicleTable
  • Call the supplied subprogram, displayTable(), to show the contents of vehicleTable
  • The program must work with any number of lines in the data file.

Use comments, white space, and indentation to make your program easy to read and understand.

Do not add any additional functionality.

Save your amended code as Q06FINISHED.py

[15]

Input/output Questions

Practise Edexcel GCSE Computer Science Input/output with exam-style questions for GCSE Computer Science. 29 questions covering Accepting and responding to user input, Reading and writing CSV text files, Implementing validation, and Implementing authentication, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Input/output Questions

  1. GCSE
  2. /Computer Science
  3. /Input/output