Code Writer
Level 3, 2026-03-22
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
A rectangle has sides of 5 and 3. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
Use a loop to print 27 lines with the numbers from 1 to 27 and each number times 19, separated by a commma.
For example, line 1 would be "1, 19", line 2 would be "2, 38",etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST and print the result.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Print each number from 0 to 35
Use: loops[2]
|
|
|
|
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 196HP. 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 triangle has sides of 2, 9 and 6. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Use a loop to multiply the numbers from 2 to 15
Use: variables, loops[2]
|
|
|
|
|