Code Writer
Level 3, 2026-06-25
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 6. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Print each number from 0 to 40
Use: loops[2]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
A triangle has sides of 5, 8 and 3. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Assume you have 2 lists of numbers with 7 elements each: Q and VAR. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,...,7], VAR = [1,2,3,...,7] |
Assume you have 2 lists of numbers that are the same size: E and B. Count how many times an element in E is bigger than the element in the same position in B.
Use: variables, loops[2]
|
|
|
Test Using: E = [5], B = [5] E = [1,2,3], B = [3,2,1] E = [31,28,58], B = [56,0,52] |
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
|