Code Writer
Level 3, 2026-08-15
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have a non-empty list of scores F for your math class. Calculate the sum of the scores.
Use: variables, loops[3]
|
|
|
Test Using: F = [10] F = [1,2,3,4,5] F = [31,63,80] |
Assume you have 2 lists of numbers with 13 elements each: VAR and F. Add the 7th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,...,13], F = [1,2,3,...,13] |
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 8 to 20
Use: variables, loops[2]
|
|
|
|
Use a loop to print the sum of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 200HP. 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] |
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 89!
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of numbers F. Print the 10th element of F.
Use: variables[1]
|
|
|
Test Using: F = [1,2,3,4,5,6,7,8,9,10] |
|