Run code as often as you like. Checking an answer uses the example and hidden test cases.
Unit 1 · Printing text
Complete the program so it displays exactly: Hello, Mia!
Open taskUnit 1 · Printing text
Write a two-line program. Line 1 must display Computer Science. Line 2 must display I can code!
Open taskUnit 1 · Printing numbers
Change the value so the program displays the number 150.
Open taskUnit 1 · Printing numbers
Write a program that displays 42 on the first line and 3.5 on the second line.
Open taskUnit 2 · Creating variables
Create a variable called team, store Tigers in it, then print the variable.
Open taskUnit 2 · Creating variables
Create player_name with the value Sam and starting_score with the value 5. Print each variable on its own line.
Open taskUnit 2 · Updating variables
Start points at 3, add 2 by updating the variable, then print the result.
Open taskUnit 2 · Updating variables
Create score with a starting value of 10. Add 5, then add 2, and print the final score.
Open taskUnit 3 · Getting user input
Ask for a first name, store it in name, then print the response on its own.
Open taskUnit 3 · Getting user input
Ask for the user's favourite subject, store the answer, then print exactly what they entered.
Open taskUnit 3 · Combining input and output
Ask for a name, then display Hello, followed by a space and that name.
Open taskUnit 3 · Combining input and output
Ask for a football team and display: You support TEAM! Replace TEAM with the input.
Open taskUnit 4 · Strings and integers
Store Taylor in a string variable called name and 15 in an integer variable called age. Print each on a new line.
Open taskUnit 4 · Strings and integers
Create product_code as the string 0042 and quantity as the integer 3. Print both values on separate lines.
Open taskUnit 4 · Converting input into numbers
Ask for an age, cast it to an integer, add one and print the result.
Open taskUnit 4 · Converting input into numbers
Ask how many quiz points the user has, cast the input to an integer, add 5 bonus points and print the new total.
Open taskUnit 5 · Sequence and arithmetic operators
Ask for a whole-number price and quantity, multiply them, then print the total as a number on its own line.
Open taskUnit 5 · Sequence and arithmetic operators
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 taskUnit 5 · DIV, MOD and useful patterns
Ask for a total number of minutes. Print the whole hours, then print the leftover minutes on the next line.
Open taskUnit 5 · DIV, MOD and useful patterns
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 taskUnit 5 · Powers, order and incrementing
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 taskUnit 5 · Powers, order and incrementing
Ask for the player's current level. Increment level by one, calculate reward as the updated level squared plus 5, then print reward.
Open taskUnit 6 · Boolean expressions and comparisons
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 taskUnit 6 · Boolean expressions and comparisons
Ask for a room type and print True only when the exact input is basic or premium. Otherwise print False.
Open taskUnit 6 · If, elseif and else
Ask for a whole-number temperature. Print Hot when it is 25 or above; otherwise print Mild.
Open taskUnit 6 · If, elseif and else
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 taskUnit 6 · Nested selection and precedence
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 taskUnit 6 · Nested selection and precedence
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 taskUnit 6 · Switch and case
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 taskUnit 6 · Switch and case
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 taskUnit 7 · For loops
Ask for a number of repetitions and print Hello on its own line exactly that many times.
Open taskUnit 7 · For loops
Ask for a positive whole number n. Print every number from 1 to n inclusive, one per line.
Open taskUnit 7 · Range and step
Ask for an even limit. Print every even number from 2 up to and including that limit.
Open taskUnit 7 · Range and step
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 taskUnit 7 · While loops
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 taskUnit 7 · While loops
Ask for a password. Keep asking while it is not exactly secret. When secret is entered, print Access granted.
Open taskUnit 7 · Do-until and input loops
Use while True to keep asking until the user enters exactly yes. Then print Confirmed.
Open taskUnit 7 · Do-until and input loops
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 taskUnit 7 · Counters and accumulators
Ask for three integer scores, add them into one running total, then print the total.
Open taskUnit 7 · Counters and accumulators
Ask for four integer scores. Count and print how many scores are 5 or greater.
Open taskUnit 7 · Nested loops
Ask for rows and columns. Print every zero-indexed coordinate as row,column on its own line, with no spaces.
Open taskUnit 7 · Nested loops
Ask for a height and width. Use nested loops to print X once per cell, with each X on its own line.
Open taskUnit 8 · Concatenation, length and case
Ask for a first name and surname. Join them with one space, convert the full name to uppercase and print it.
Open taskUnit 8 · Concatenation, length and case
Ask for one word. Print its number of characters, then print its lowercase form on the next line.
Open taskUnit 8 · Indexing and substrings
Ask for a word with at least three characters. Print its first character, then its last three characters on the next line.
Open taskUnit 8 · Indexing and substrings
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 taskUnit 8 · ASC and CHR
Ask for one character and print its numeric character code.
Open taskUnit 8 · ASC and CHR
Ask for one uppercase letter from A to Y. Print the next character by converting to a code, adding one and converting back.
Open taskUnit 8 · One-dimensional arrays
Ask for three names, store them in one list named names, then print the first and third names on separate lines.
Open taskUnit 8 · One-dimensional arrays
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 taskUnit 8 · Looping through 1D arrays
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 taskUnit 8 · Looping through 1D arrays
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 taskUnit 8 · Two-dimensional arrays
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 taskUnit 8 · Two-dimensional arrays
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 taskUnit 9 · Defining and calling procedures
Define a Python procedure named show_result with no parameters. It must print Result ready. Call the procedure once.
Open taskUnit 9 · Defining and calling procedures
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 taskUnit 9 · Using parameters
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 taskUnit 9 · Using parameters
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 taskUnit 9 · Functions and returned values
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 taskUnit 9 · Functions and returned values
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 taskUnit 9 · Local and global variables
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 taskUnit 9 · Local and global variables
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 taskUnit 9 · Passing and returning arrays
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 taskUnit 9 · Passing and returning arrays
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 taskUnit 10 · Defensive design and authentication
Read a username and password. Print Access granted only for username admin and password secret123; otherwise print Access denied.
Open taskUnit 10 · Defensive design and authentication
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 taskUnit 10 · Range validation with loops
Keep asking for an integer until it is from 1 to 10 inclusive. Then print Accepted: followed by the number.
Open taskUnit 10 · Range validation with loops
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 taskUnit 10 · Presence, length, type and format checks
Keep asking for a name until it is not blank, then print the accepted name.
Open taskUnit 10 · Presence, length, type and format checks
Keep asking for a code until it has exactly five characters and character index 2 is a hyphen. Then print the accepted code.
Open taskUnit 10 · Syntax, runtime and logic errors
Read distance and time as floats. If time is zero, print Cannot divide by zero. Otherwise calculate distance / time and print the result.
Open taskUnit 10 · Syntax, runtime and logic errors
Read a float divisor. If it is zero, print Cannot divide by zero. Otherwise print 10 divided by that value.
Open taskUnit 10 · Test data and test plans
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 taskUnit 10 · Test data and test plans
Keep asking for an integer rating until it is from 1 to 5 inclusive. Print ALLOWED after a valid value is entered.
Open taskUnit 10 · Reading and writing files
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 taskUnit 10 · Reading and writing files
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 taskUnit 10 · Random integer generation
Import random, read an integer seed, call random.seed(seed), generate one random integer from 1 to 6 inclusive and print it.
Open taskUnit 10 · Random integer generation
Import random, read an integer seed, seed the generator, generate one integer from 1 to 10 inclusive and print it.
Open taskUnit 10 · Decomposition and complete solutions
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 taskUnit 10 · Decomposition and complete solutions
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