Knowledge organisersProgramming Fundamentals
Practical use of the techniques
Variables and constants are fundamental building blocks of any program. A variable is a named storage location whose value can change during the program. A constant is a named value that does not change. Programs use inputs to receive data, outputs to display results, and assignment statements to store values in variables.
score = 0, radius = 0, area = 0.0.PI = 3.142 or const VAT = 0.2.= to store a value in a variable, e.g. name = "Alice". Do NOT use == for assignment.name = input("Enter your name"). Note: input cannot be used as a variable name.print("Hello World").radius, area, score, staffID, etc. Give the exact identifier from the code.word1.# Constant (does not change)
VAT_RATE = 0.2
# Input
price = float(input("Enter the price: "))
# Assignment and calculation
total = price + (price * VAT_RATE)
# Output
print("Total with VAT:", total)