A program is being written to simulate the environmental conditions of a smart greenhouse. The simulator needs to generate a random humidity percentage as a whole number between 45 and 85 inclusive.
An incomplete Python program is provided below:
# Program to simulate greenhouse humidity levels
# TODO 1: Import the random library
# TODO 2: Create a constant called MAX_HUMIDITY and set it to 85
MIN_HUMIDITY = 45
# TODO 3 & 4: Create a variable called simulated_humidity and assign
# the result of a library call to generate a random integer
# between MIN_HUMIDITY and MAX_HUMIDITY (inclusive)
# TODO 5: Display the message "Current relative humidity: " followed
# by the value of simulated_humidity
Amend the code by completing the sections marked with TODO to:
MAX_HUMIDITY with the value 85simulated_humidityMIN_HUMIDITY and MAX_HUMIDITY inclusive, assigning it to simulated_humidity"Current relative humidity: " and the value of simulated_humidity on the screenDo not add any additional functionality.
44 exam-style questions on Edexcel GCSE Computer Science Data types and structures, covering Primitive and structured data types, Using variables and constants, and Manipulating strings. Each one has a worked solution and a mark scheme showing where the marks go.