ProceduralOCR J277
DashboardCoursePracticeReviewProgressGlossary
Saved on this deviceContinue learning

Procedural · OCR J277 programming practice

Progress stays in this browser unless you export it.

Python practice

Turn understanding into working code

Run code as often as you like. Checking an answer uses the example and hidden test cases.

0/80tasks passed
Not tried

Unit 1 · Printing text

Scaffolded practice

Complete the program so it displays exactly: Hello, Mia!

Open task
Not tried

Unit 1 · Printing text

Independent task

Write a two-line program. Line 1 must display Computer Science. Line 2 must display I can code!

Open task
Not tried

Unit 1 · Printing numbers

Scaffolded practice

Change the value so the program displays the number 150.

Open task
Not tried

Unit 1 · Printing numbers

Independent task

Write a program that displays 42 on the first line and 3.5 on the second line.

Open task
Not tried

Unit 2 · Creating variables

Scaffolded practice

Create a variable called team, store Tigers in it, then print the variable.

Open task
Not tried

Unit 2 · Creating variables

Independent task

Create player_name with the value Sam and starting_score with the value 5. Print each variable on its own line.

Open task
Not tried

Unit 2 · Updating variables

Scaffolded practice

Start points at 3, add 2 by updating the variable, then print the result.

Open task
Not tried

Unit 2 · Updating variables

Independent task

Create score with a starting value of 10. Add 5, then add 2, and print the final score.

Open task
Not tried

Unit 3 · Getting user input

Scaffolded practice

Ask for a first name, store it in name, then print the response on its own.

Open task
Not tried

Unit 3 · Getting user input

Independent task

Ask for the user's favourite subject, store the answer, then print exactly what they entered.

Open task
Not tried

Unit 3 · Combining input and output

Scaffolded practice

Ask for a name, then display Hello, followed by a space and that name.

Open task
Not tried

Unit 3 · Combining input and output

Independent task

Ask for a football team and display: You support TEAM! Replace TEAM with the input.

Open task
Not tried

Unit 4 · Strings and integers

Scaffolded practice

Store Taylor in a string variable called name and 15 in an integer variable called age. Print each on a new line.

Open task
Not tried

Unit 4 · Strings and integers

Independent task

Create product_code as the string 0042 and quantity as the integer 3. Print both values on separate lines.

Open task
Not tried

Unit 4 · Converting input into numbers

Scaffolded practice

Ask for an age, cast it to an integer, add one and print the result.

Open task
Not tried

Unit 4 · Converting input into numbers

Independent task

Ask how many quiz points the user has, cast the input to an integer, add 5 bonus points and print the new total.

Open task
Not tried

Unit 5 · Sequence and arithmetic operators

Scaffolded practice

Ask for a whole-number price and quantity, multiply them, then print the total as a number on its own line.

Open task
Not tried

Unit 5 · Sequence and arithmetic operators

Independent task

Ask for the goals scored in the first half and second half. Add them and print the total goals as a number on its own line.

Open task
Not tried

Unit 5 · DIV, MOD and useful patterns

Scaffolded practice

Ask for a total number of minutes. Print the whole hours, then print the leftover minutes on the next line.

Open task
Not tried

Unit 5 · DIV, MOD and useful patterns

Independent task

Ask for a number of items and a box size. Print the number of complete boxes, then the number of items left over on the next line.

Open task
Not tried

Unit 5 · Powers, order and incrementing

Scaffolded practice

Ask for a whole number. Print its square, then increment the original number by one and print the updated number on the next line.

Open task
Not tried

Unit 5 · Powers, order and incrementing

Independent task

Ask for the player's current level. Increment level by one, calculate reward as the updated level squared plus 5, then print reward.

Open task
Not tried

Unit 6 · Boolean expressions and comparisons

Scaffolded practice

Ask for an age, cast it to an integer and print the Boolean result of checking whether it is from 13 to 19 inclusive.

Open task
Not tried

Unit 6 · Boolean expressions and comparisons

Independent task

Ask for a room type and print True only when the exact input is basic or premium. Otherwise print False.

Open task
Not tried

Unit 6 · If, elseif and else

Scaffolded practice

Ask for a whole-number temperature. Print Hot when it is 25 or above; otherwise print Mild.

Open task
Not tried

Unit 6 · If, elseif and else

Independent task

Ask for an integer score. Print Distinction for 70 or more, Merit for 50–69, Pass for 40–49, and Fail for anything lower.

Open task
Not tried

Unit 6 · Nested selection and precedence

Scaffolded practice

Ask for armed and sensor_active as 1 or 0. Use an if inside another if. Print Alarm only when both values are 1; otherwise print Safe.

Open task
Not tried

Unit 6 · Nested selection and precedence

Independent task

Ask for armed, door_active and window_active as 1 or 0. Print Alarm only when armed is 1 and either sensor is 1. Otherwise print Safe. Use brackets to show the sensor grouping.

Open task
Not tried

Unit 6 · Switch and case

Scaffolded practice

Ask for an integer menu choice. Print Play for 1, Settings for 2, and Invalid for every other value. Use Python if/elif/else as the switch equivalent.

Open task
Not tried

Unit 6 · Switch and case

Independent task

Ask for a traffic-light colour. Print Stop for red, Wait for amber, Go for green, and Unknown for any other exact input. Use Python if/elif/else.

Open task
Not tried

Unit 7 · For loops

Scaffolded practice

Ask for a number of repetitions and print Hello on its own line exactly that many times.

Open task
Not tried

Unit 7 · For loops

Independent task

Ask for a positive whole number n. Print every number from 1 to n inclusive, one per line.

Open task
Not tried

Unit 7 · Range and step

Scaffolded practice

Ask for an even limit. Print every even number from 2 up to and including that limit.

Open task
Not tried

Unit 7 · Range and step

Independent task

Ask for a start and an end. Print values from start to end inclusive in steps of 3. The end will be reachable from the start by adding 3.

Open task
Not tried

Unit 7 · While loops

Scaffolded practice

Ask for a whole number. While it is below 5, print it and add one. Print nothing if the first number is already 5 or more.

Open task
Not tried

Unit 7 · While loops

Independent task

Ask for a password. Keep asking while it is not exactly secret. When secret is entered, print Access granted.

Open task
Not tried

Unit 7 · Do-until and input loops

Scaffolded practice

Use while True to keep asking until the user enters exactly yes. Then print Confirmed.

Open task
Not tried

Unit 7 · Do-until and input loops

Independent task

Use a post-test pattern to ask for integers until one is from 1 to 5 inclusive. Combine complete lower and upper comparisons with and, then print the accepted number.

Open task
Not tried

Unit 7 · Counters and accumulators

Scaffolded practice

Ask for three integer scores, add them into one running total, then print the total.

Open task
Not tried

Unit 7 · Counters and accumulators

Independent task

Ask for four integer scores. Count and print how many scores are 5 or greater.

Open task
Not tried

Unit 7 · Nested loops

Scaffolded practice

Ask for rows and columns. Print every zero-indexed coordinate as row,column on its own line, with no spaces.

Open task
Not tried

Unit 7 · Nested loops

Independent task

Ask for a height and width. Use nested loops to print X once per cell, with each X on its own line.

Open task
Not tried

Unit 8 · Concatenation, length and case

Scaffolded practice

Ask for a first name and surname. Join them with one space, convert the full name to uppercase and print it.

Open task
Not tried

Unit 8 · Concatenation, length and case

Independent task

Ask for one word. Print its number of characters, then print its lowercase form on the next line.

Open task
Not tried

Unit 8 · Indexing and substrings

Scaffolded practice

Ask for a word with at least three characters. Print its first character, then its last three characters on the next line.

Open task
Not tried

Unit 8 · Indexing and substrings

Independent task

Ask for an eight-character code whose last four characters are digits. Print the first four characters, then print the numeric suffix multiplied by 2.

Open task
Not tried

Unit 8 · ASC and CHR

Scaffolded practice

Ask for one character and print its numeric character code.

Open task
Not tried

Unit 8 · ASC and CHR

Independent task

Ask for one uppercase letter from A to Y. Print the next character by converting to a code, adding one and converting back.

Open task
Not tried

Unit 8 · One-dimensional arrays

Scaffolded practice

Ask for three names, store them in one list named names, then print the first and third names on separate lines.

Open task
Not tried

Unit 8 · One-dimensional arrays

Independent task

Ask for three integer scores and store them in one list named scores. Add 5 to the second score, then print all three scores on separate lines.

Open task
Not tried

Unit 8 · Looping through 1D arrays

Scaffolded practice

Ask for four integer scores and store them in a list named scores. Use a for loop and indexed access to total them, then print the total.

Open task
Not tried

Unit 8 · Looping through 1D arrays

Independent task

Ask for a target name, then ask for four team names and store them in a list named team. Traverse by index using len(team). Print Found if the exact target appears; otherwise print Not found.

Open task
Not tried

Unit 8 · Two-dimensional arrays

Scaffolded practice

Ask for four text values and store them as a 2×2 table named table in row order. Use nested for loops, len() and both indices to print every cell in row order, one value per line.

Open task
Not tried

Unit 8 · Two-dimensional arrays

Independent task

Ask for a first product name and price, then a second product name and price. Store two rows [name, price] in a 2D list named products, keeping prices as input strings. Read both prices from the table, cast them to float, add them and print the total.

Open task
Not tried

Unit 9 · Defining and calling procedures

Scaffolded practice

Define a Python procedure named show_result with no parameters. It must print Result ready. Call the procedure once.

Open task
Not tried

Unit 9 · Defining and calling procedures

Independent task

Define a procedure named match_intro that prints Match starting and then Teams ready on the next line. Call that same procedure twice so its two-line output is reused.

Open task
Not tried

Unit 9 · Using parameters

Scaffolded practice

Define show_points(player, points), which prints the player, a space, and the points. In the main program, read two different player/points pairs and call the same procedure once for each pair, in input order.

Open task
Not tried

Unit 9 · Using parameters

Independent task

Define announce_result(team, goals). It must print team + ' scored ' + goals. Read the team and integer goals in the main program, then call the procedure.

Open task
Not tried

Unit 9 · Functions and returned values

Scaffolded practice

Define double_number(number) and return number multiplied by 2. Read an integer, call the function, store that returned value in a main-program variable named result, then print result.

Open task
Not tried

Unit 9 · Functions and returned values

Independent task

Define calculate_change(paid, cost), which returns paid minus cost in that order. Read paid and cost as integers, call the function, store its returned value in result and print result.

Open task
Not tried

Unit 9 · Local and global variables

Scaffolded practice

Define add_bonus(score), create a local variable named result that adds 5, and return result. Read an integer in the main program, call the function, store its returned value in a main-program variable named new_score and print new_score.

Open task
Not tried

Unit 9 · Local and global variables

Independent task

Create global score = 0. Define add_points(points), use Python's global declaration and add points to score. Read two integer point values, call the procedure for each, then print score.

Open task
Not tried

Unit 9 · Passing and returning arrays

Scaffolded practice

Define double_values(numbers). Build a new list by doubling each number and return it. Read three integers into numbers, call the function, store its returned list in a main-program variable named doubled and print doubled.

Open task
Not tried

Unit 9 · Passing and returning arrays

Independent task

Define total_scores(scores). Use a for loop with range(len(scores)) and indexed access to return the total. Read three integer scores into a list, call the function, store the returned value in result and print result.

Open task
Not tried

Unit 10 · Defensive design and authentication

Scaffolded practice

Read a username and password. Print Access granted only for username admin and password secret123; otherwise print Access denied.

Open task
Not tried

Unit 10 · Defensive design and authentication

Independent task

Allow up to three username/password attempts using a while loop. The valid pair is admin and secret123. Stop early after a correct pair. Print exactly Access granted or, after three failed pairs, Access denied.

Open task
Not tried

Unit 10 · Range validation with loops

Scaffolded practice

Keep asking for an integer until it is from 1 to 10 inclusive. Then print Accepted: followed by the number.

Open task
Not tried

Unit 10 · Range validation with loops

Independent task

Keep asking for an integer age until it is from 0 to 120 inclusive. Print the accepted age as a number on its own line.

Open task
Not tried

Unit 10 · Presence, length, type and format checks

Scaffolded practice

Keep asking for a name until it is not blank, then print the accepted name.

Open task
Not tried

Unit 10 · Presence, length, type and format checks

Independent task

Keep asking for a code until it has exactly five characters and character index 2 is a hyphen. Then print the accepted code.

Open task
Not tried

Unit 10 · Syntax, runtime and logic errors

Scaffolded practice

Read distance and time as floats. If time is zero, print Cannot divide by zero. Otherwise calculate distance / time and print the result.

Open task
Not tried

Unit 10 · Syntax, runtime and logic errors

Independent task

Read a float divisor. If it is zero, print Cannot divide by zero. Otherwise print 10 divided by that value.

Open task
Not tried

Unit 10 · Test data and test plans

Scaffolded practice

Keep asking for an integer until it is from 1 to 100 inclusive, then print Accept. Your checker will supply normal, boundary and invalid-then-valid inputs.

Open task
Not tried

Unit 10 · Test data and test plans

Independent task

Keep asking for an integer rating until it is from 1 to 5 inclusive. Print ALLOWED after a valid value is entered.

Open task
Not tried

Unit 10 · Reading and writing files

Scaffolded practice

Read a name. Open student.txt in write mode, write the name plus a newline, close it, reopen in read mode and print the saved name with no extra blank line.

Open task
Not tried

Unit 10 · Reading and writing files

Independent task

Read a team and integer score. Write team + ',' + score and a newline to result.txt using write mode. Close it, reopen in read mode and print the saved line with no extra blank line.

Open task
Not tried

Unit 10 · Random integer generation

Scaffolded practice

Import random, read an integer seed, call random.seed(seed), generate one random integer from 1 to 6 inclusive and print it.

Open task
Not tried

Unit 10 · Random integer generation

Independent task

Import random, read an integer seed, seed the generator, generate one integer from 1 to 10 inclusive and print it.

Open task
Not tried

Unit 10 · Decomposition and complete solutions

Scaffolded capstone

Build the member-total program from the example. Define calculate_cost(items, member): items cost 4 each and members receive 2 off. Validate member as yes/no with a while loop, validate items as 1-5 with another while loop, call the function and print the returned total.

Open task
Not tried

Unit 10 · Decomposition and complete solutions

Independent capstone

Create ticket_price(age), returning 5 for ages below 16 and 8 otherwise. Validate ticket_count as 1-3. For each ticket, read and validate age as 0-120, call the function and add its return to total. Print the final total.

Open task