Constructs

EasyMediumHard
123456789101112131415161718192021222324252627282930
Question 27
Medium

A program processes smart greenhouse temperature readings to determine ventilation fan speed settings.

The program must continually prompt the user to input a temperature reading (an integer in °C) and output the corresponding classification until the user inputs -99 to stop the program.

The lines of code required for this program are currently mixed up and have had their indentation removed.

Mapping Table

Input temperature (°C)Output
-99Exits program
15 or less"Off"
16 to 28"Low"
29 or more"High"

Scrambled Lines of Code

  • temp = int(input("Enter temp: "))
  • while temp != -99:
  • print("Low")
  • if temp <= 15:
  • print("High")
  • elif temp <= 28:
  • print("Off")
  • temp = int(input("Enter temp: "))
  • else:

Rearrange these exact lines of code and apply correct indentation, white space, and logical order so that the program runs correctly and produces the required outputs.

Do not change the text or commands inside the provided lines of code. Do not add any additional statements.

[15]

Constructs Questions

  1. GCSE
  2. /Computer Science
  3. /Constructs