Code Writer
Level 3, 2026-08-13
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 12 and another side of 5. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a list of numbers VAR. Create a new variable that is equal to sum of all the numbers in VAR.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [] VAR = [1,1] VAR = [67,61,52] |
Use a loop to print the sum of the numbers from 6 to 18
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers that are the same size: A and VAR. Count how many times an element in A is bigger than or equal to the element in the same position in VAR.
Use: variables, loops[2]
|
|
|
Test Using: A = [5], VAR = [5] A = [1,2,3], VAR = [3,2,1] A = [34,79,81], VAR = [65,69,29] |
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the area of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 79, T = 70 |
Assume you have a non-empty list B. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: B = [1] B = ['a','b','c'] B = [56,57,53] |
Set two variables to different strings then make a new variable that combines them with a "c" in between
Use: variables[1]
|
|
|
|
|