Code Writer
Level 3, 2026-08-08
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print 24 lines with a line number and the word "nose". For example, line 1 should be "1: nose", line 2 would be "2: nose", etc.
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
A list contains a series of attacks on an enemy. The list looks like [1,2,3,1,1,2,...] where each element in the list is a number that means a type of attack:
1 is a light attack, taking 3HP 2 is a medium attack taking 5HP 3 is a strong attack taking 7HP
Write code to calculate the total amount of HP damage caused by all the attacks.
Use: variables, loops, if[3]
|
|
|
Test Using: attacks = [1,2,3] attacks = [1,2,3,3,2,1] attacks = [99,98,11] |
Use a loop to print 39 lines with a line number and the word "bloop". For example, line 1 should be "1: bloop", line 2 would be "2: bloop", etc.
Use: variables, loops, str()[2]
|
|
|
|
Do the sum 45 / 38 and print the result
Use: [1]
|
|
|
|
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 14 and another side of 3. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Assume you have a list of numbers B. Create a new variable that is equal to sum of all the numbers in B.
Use: variables, loops[2]
|
|
|
Test Using: B = [] B = [1,1] B = [64,88,67] |
Assume you have 2 lists of numbers with 6 elements each: VAR and Z. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,...,6], Z = [1,2,3,...,6] |
|