Code Writer
Level 3, 2026-12-03
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 variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.
Use: variables[2]
|
|
|
Test Using: S = 47 |
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 = [54,26,52] |
Assume you have a list of numbers VAR. Print the 7th element of VAR.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,4,5,6,7,8,9,10] |
Use a loop to print 50 lines with a line number and the word "plop". For example, line 1 should be "1: plop", line 2 would be "2: plop", etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of numbers Y. Write code to count how many numbers in the list are smaller than or equal to than 5
Use: variables, loops, if[3]
|
|
|
Test Using: Y = [] Y = [5,0,25] Y = [7,31,88] |
Use a loop to print the average of the numbers from 0 to 5
Use: variables, loops[2]
|
|
|
|
Do the sum 59 / 53 in code and store the result
Use: variables[1]
|
|
|
|
Use a loop to multiply the numbers from 1 to 27
Use: variables, loops[2]
|
|
|
|
|