Code Writer
Level 3, 2026-06-09
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 list of numbers F. Create a new variable that is equal to sum of all the numbers in F.
Use: variables, loops[2]
|
|
|
Test Using: F = [] F = [1,1] F = [55,51,21] |
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 = 72, T = 13 |
Print each number from 1 to 47
Use: loops[2]
|
|
|
|
Use a loop to print the sum of the numbers from 0 to 3
Use: variables, loops[2]
|
|
|
|
Assume you have a list of letters X. Write code to count the number of times the letter "c" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: X = [] X = ['c','a','z'] X = ['c','c','c'] |
Assume you have a non-empty list of numbers Y. Create a new variable that is equal all the numbers in Y multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: Y = [1,1] Y = [1,2,3,4,5] Y = [37,90,50] |
A rectangle has sides of 2 and 9. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Assume you have a list of numbers Q. Print the 8th element of Q.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,4,5,6,7,8,9,10] |
|