Fundamental Logic Bank
High-speed algorithmic revision. Master the core syntax required for Section B marks.
The Missing Input (1 Mark)
A program asks for a PIN code. Complete the code to store the user's input in the variable pin.
Examiner's Notes
- Using the
input()function correctly with standard variable assignment.
Fixing the Math (2 Marks)
This code crashes because input() returns a string. Cast it to an Integer so the math works.
Joining Strings (1 Mark)
Join the two strings together and print the result: "HelloEveryone".
Shopping Math (1 Mark)
Calculate the total price for 5 items at 10 each.
Pass or Fail (2 Marks)
Check the score. If it's 50 or more, print "Pass". Else print "Fail".
Status Update (1 Mark)
Set the variable `is_active` to True.
Pick a Color (1 Mark)
Print the 3rd item in the list ("Green"). Remember Index starts at 0!
Trace Code (1 Mark)
What is the final value of `x`? Print it.
Logic Error (1 Mark)
The user should pass if they are 18 OR have a ticket. Fix the mistake.
Call Function (1 Mark)
Call the function `double` with the number 5 and print the result.
Float Times (1 Mark)
Multiply 5 by 2.5 and print the result.
String Slicing (1 Mark)
Print the first two letters of "Python" (Result: "Py").
Countdown (1 Mark)
Complete the range to print 3, 2, 1.
Add to List (1 Mark)
Add "Purple" to the end of the colors list.
Traffic Lights (2 Marks)
If light is "Green", print "Go". Else print "Stop".
Modulo Remainder (1 Mark)
Calculate the remainder of 10 / 3 using Modulo.
Swap Variables (2 Marks)
Swap the values of a and b using the temporary variable `t`.
Syntax Fix (1 Mark)
Fix the syntax error in the If statement.
Logic Gates (1 Mark)
What is (True AND False) OR True? Print the result.
Return Value (1 Mark)
Make the function return the value of a squared.
Update Score
Update the variable `score` to 20.
Length of String
Print the length of the string "Exam".
Subtraction
Subtract 5 from 10 and print.
Repeat String
Print "Go" 3 times.
Replace Item
Change the first item of `nums` to 5.
Not Equal
Print True if 5 is not equal to 10.
Less Than
Print True if 5 is less than 10.
If/Elif
If x > 10 print "Big", elif x > 0 print "Medium".
Explicit Logic
Set `ticket = True`. Print "Valid" if `age >= 18` or `ticket`.
Int + Float
Add 2 and 3.0 and print.
Floor Division
Calculate 10 // 3 and print.
Exponents
Calculate 2 to the power of 3 and print.
Membership Check
Print "Found" if "A" is in `grades`.
Not In Check
Print "Safe" if "Virus" is NOT in `files`.
Two Arguments
Complete the function to add two numbers `a` and `b`.
Mixed Types
Print "Score: " joined with `points` (cast points to string!).
Pop Item
Remove the last item from `items` and print the list.
Range Loop
Print numbers from 1 to 3.
Accumulator
Print the sum of 1 and 2 using the `total` variable.
Name Error
Fix the variable name in the print statement.
Level 1 Mastery!
You've secured the foundational method marks. Ready to handle logic branching and data structures?
Enter Level 2