Code Writer
Level 3, 2026-06-12
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
A rectangle has sides of 6 and 2. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Assume you have 2 lists of numbers that are the same size: A and Z. Count how many times an element in A is bigger than or equal to the element in the same position in Z.
Use: variables, loops[2]
|
|
|
Test Using: A = [5], Z = [5] A = [1,2,3], Z = [3,2,1] A = [10,2,53], Z = [97,3,34] |
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 = [42,15,84] |
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 = 85, T = 79 |
Assume you have a non-empty list of numbers E. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: E = [1,2,3] E = [3,2,1,0] E = [42,47,90] |
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 = 85, T = 79 |
Assume you have a non-empty list B. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: B = [1] B = ['a','b','c'] B = [35,61,2] |
Assume you have a non-empty list F. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: F = [1] F = ['a','b','c'] F = [35,61,2] |
|