Skip to content

Course home

Develop code

Develop code

EasyMediumHard
123456789101112131415161718192021222324
Question 16

Anusha has written a Python program to extract and display freezing temperatures from a list of readings.

freezing_temps = []
temperatures = [3.5, -1.2, 0.0, 4.2, -3.1, 5.0]
for temp in temperatures:
    if temp <= 0.0:
         freezing_temps.append(temp)
print("Freezing temperatures:", freezing_temps)

Amend the code by adding a suitable comment (using the # symbol in Python) to the end of the line that corresponds to each of the following:

a.

At the end of the line where a relational operator is evaluated.

[1]
b.

At the end of the line where iteration begins.

[1]
c.

At the end of the line where selection begins.

[1]
d.

At the end of a line where a data structure is initialised.

Note: If a line meets more than one criterion, you may append multiple comments to that line.

[1]
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