Signed up recently but had issues with the confirmation email?
Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.
Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.
The use of variables, constants, operators, inputs, outputs and assignments
2.2.1 Programming Fundamentals
Practise exam questionsProgramming Fundamentals — Note 1 of 6
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, lives = 3, price = 0.0.const VAT = 0.2 or const MAX_LIVES = 3.= to store a value in a variable, for example username = "player1". Do NOT use == for assignment.name = input("Enter your name"). Note: input cannot be used as a variable name.print("Hello World").input() ALWAYS returns a string. Wrap it in int() or float() before doing any maths with the value.print() with commas puts a space between each item: if name holds "player1", print("Hello", name) outputs Hello player1.// Constant (does not change)
const VAT_RATE = 0.2
// Input
price = float(input("Enter the price: "))
// Assignment and calculation
total = price + (price * VAT_RATE)
// Output
print("Total with VAT: " + str(total))# 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)name = input("Enter your name: ")
print("Hello", name)
# input() returns a string, so cast it before doing maths
age = int(input("Enter your age: ")) # whole number
height = float(input("Enter your height in m: ")) # decimal
print("Next year you will be", age + 1)The act of creating a named location in memory to store a value. The value can change during program execution.
The act of creating a named memory location whose value cannot change during program execution.
name = input("Name?"), never input("Name?") = name), and a new value REPLACES the old one: after lives = 3 then lives = 5, lives holds 5 only.print("lives") outputs the word lives, not its value. Keep text inside the quotes and variables outside them, joined with +: print("Lives left: " + str(lives)).score, total or lives. Give the exact identifier from the code.firstName, score2 and top_score are valid; first name and 2score are not. Use the exact name the question gives; a version with a space is not accepted.age = input("Age? ") followed by age + 1 causes an error, because age is a string, not a number.Ready to test yourself?
Practise 2.2.1 questions