Programmers often use uppercase letters to represent a constant value in their code.
An example of a constant is shown on line 3 in the following code snippet:
2 # Settings for the cloud storage application
3 MAX_FILE_SIZE = 50 # Maximum allowed file size in MB
4
5 current_file_size = 12 # Size of the current file being uploaded
Explain one reason why a programmer would use a named constant like MAX_FILE_SIZE instead of repeating the literal value 50 throughout their program.
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.