Robust and secure programming

EasyMediumHard
123456789101112131415161718
Question 16
Easy

Complete the test plan for the Python code shown in the code block below, which is designed to validate a target humidity percentage set-point for an automated greenhouse control system.

valid_humidity = False
while not valid_humidity:
    humidity = int(input("Enter target humidity [45 to 65]: "))
    if humidity >= 45 and humidity <= 65:
        valid_humidity = True
    else:
        print("Alert: Humidity out of range")
print("Target humidity updated successfully")
Test typeTest dataExpected result
Normal data55"Target humidity updated successfully" displayed
Invalid data[1][2]
Boundary data[3][4]
[2]

Robust and secure programming Questions

  1. GCSE
  2. /Computer Science
  3. /Robust and secure programming