Code Writer
Level 3, 2026-04-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 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 = 12 |
Assume you have a list of numbers X. Write code to add up the numbers in the list that are smaller than or equal to than 10
Use: variables, loops, if[3]
|
|
|
Test Using: X = [] X = [5,6,7,8,9,10,11,12,13,14,15] X = [69,91,88] |
Assume you have two non-empty lists of numbers Q and Y. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: Q = [1], Y = [1] Q = [1,2,3], Y = [3,2,1] Q = [64,24,15], Y = [95,69,65] |
Assume you have a list of numbers Z. Print the 6th element of Z.
Use: variables[1]
|
|
|
Test Using: Z = [1,2,3,4,5,6,7,8,9,10] |
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the area of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 42, T = 18 |
Use a loop to multiply the numbers from 8 to 23
Use: variables, loops[2]
|
|
|
|
Print your first name
Use: [1]
|
|
|
|
|