Code Writer
Level 3, 2026-11-28
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 list of numbers F. Write code to count how many numbers in the list are smaller than 13
Use: variables, loops, if[3]
|
|
|
Test Using: F = [] F = [13,0,25] F = [86,53,33] |
Assume you have a list of numbers Y. Write code to count how many numbers in the list are bigger than or equal to than 2
Use: variables, loops, if[3]
|
|
|
Test Using: Y = [] Y = [2,0,25] Y = [86,53,33] |
Do the sum 80 / 54 in code and store the result
Use: variables[1]
|
|
|
|
Use a loop to add the numbers from 0 to 20
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 189HP. 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 rectangle has sides of 8 and 3. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
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 = [10,88,30] |
|