Skip to content

Course home

Develop code

Develop code

EasyMediumHard
1234567891011121314151617181920212223242526
Question 20

Products.txt contains a list of product codes.

Open Q03a in the code editor.

Write a program to implement these requirements.

The code must:

  • read each product code from Products.txt
  • check each product code to ensure it contains a hyphen (-)
  • write any product codes that do not contain a hyphen to a Flagged.txt file

You must use the structure given in the file Q03a to complete the program.

# Q03a - Skeleton Code
infile = open("Products.txt", "r")
outfile = open("Flagged.txt", "w")

# Your code goes here

infile.close()
outfile.close()

Do not add further functionality.

[6]
Markscheme

Develop code Questions

  1. IGCSE
  2. /Computer Science
  3. /Develop code

62 exam-style questions on Edexcel IGCSE Computer Science Develop code. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank