Code Writer
Level 3, 2026-04-15
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 2 shorter sides of 6 and 6. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Do the sum 41 / 37 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have a list variable LIST of numbers. Use a variable to add the items in the list
Use: variables, loops[2]
|
|
|
Test Using: LIST = [1] LIST = [1,2,3,4,5,6,7,8,9] LIST = [82,80,22] |
Assume you have 2 lists of numbers with 10 elements each: Y and A. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,...,10], A = [1,2,3,...,10] |
A rectangle has sides of 9 and 3. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Do the sum 75 * 64 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have a list of numbers Z. Print the 9th element of Z.
Use: variables[1]
|
|
|
Test Using: Z = [1,2,3,4,5,6,7,8,9,10] |
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 134HP. Write code that works out how much damage you have taken and prints "Dead" if you are killed.
Use: variables, loops, if[3]
|
|
|
Test Using: attacks = [1] attacks = [50,50,50] attacks = [1,1,1] |
Assume you have a non-empty list Y. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: Y = [1] Y = ['a','b','c'] Y = [35,80,31] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
|