Code Writer
Level 3, 2026-02-13
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print each number from 6 to 20
Use: loops[2]
|
|
|
|
A rectangle has sides of 3 and 5. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Assume you have a non-empty list of numbers B. Create a new variable that is equal all the numbers in B multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: B = [1,1] B = [1,2,3,4,5] B = [31,17,52] |
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 1
Use: variables, loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 7
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 156HP. 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 2 lists of numbers with 11 elements each: A and X. Add the 7th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: A = [1,2,3,...,11], X = [1,2,3,...,11] |
|