301.7 Maintainable Code
Practise exam questionsMaintainable Code — Note 3 of 4
Explain code blocks.
Comments are notes in the code that Python ignores. Use # for single-line comments. Good comments explain why code does something, not what it does (the code itself shows that).
# starts a single-line comment# Apply 20% discount# Calculate final price with VAT
price = 50
vat = price * 0.2 # 20% VAT rate
total = price + vat
print(total)Specification notes for programming are in Paper 2.