Data types and structures

EasyMedium
1234567891011121314151617181920212223242526272829303132333435
Question 9
Easy

In computer programming, constant values are often defined at the top of a program using uppercase identifiers.

An example of this is shown on line 2 of the code snippet below:

1 # Automated Greenhouse Climate Control System
2 CRITICAL_TEMP_LIMIT = 38.5  # Critical temperature in degrees Celsius
3
4 current_zone_temp = 24.2     # Current temperature reading from sensor

Explain one reason why a developer should use the named constant CRITICAL_TEMP_LIMIT rather than writing the literal value 38.5 multiple times within the control system's codebase.

[2]

Data types and structures Questions

  1. GCSE
  2. /Computer Science
  3. /Data types and structures