Code Writer
Level 3, 2026-08-01
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 non-empty list of numbers VAR. Create a new variable that is equal all the numbers in VAR multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [1,1] VAR = [1,2,3,4,5] VAR = [86,75,7] |
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 perimeter of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 23, T = 17 |
Assume you have a list of numbers Z. Print the 7th element of Z.
Use: variables[1]
|
|
|
Test Using: Z = [1,2,3,4,5,6,7,8,9,10] |
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 = 23, T = 17 |
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 61!
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print 18 lines with the numbers from 1 to 18 and each number times 6, separated by a commma.
For example, line 1 would be "1, 6", line 2 would be "2, 12",etc.
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print 74 lines with the numbers from 1 to 74 and each number times 7, separated by a commma.
For example, line 1 would be "1, 7", line 2 would be "2, 14",etc.
Use: variables, loops, str()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a list of numbers B. Print the 6th element of B.
Use: variables[1]
|
|
|
Test Using: B = [1,2,3,4,5,6,7,8,9,10] |
|