Code Writer
Level 3, 2026-10-01
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a non-empty list of scores Y for your math class. Calculate the mean of the scores.
Use: variables, loops[3]
|
|
|
Test Using: Y = [10] Y = [1,2,3,4,5] Y = [56,41,18] |
Assume you have a list B with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: B = ['a','b','c'] B = ['big','dog'] B = [90,9,7] |
Use a loop to print the sum of the numbers from 0 to 3
Use: variables, loops[2]
|
|
|
|
Assume you have two non-empty lists of numbers F and Q. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: F = [1], Q = [1] F = [1,2,3], Q = [3,2,1] F = [19,19,32], Q = [74,85,24] |
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 50!
Use: variables, loops, str()[2]
|
|
|
|
Set two variables to different strings then make a new variable that combines them with a "g" in between
Use: variables[1]
|
|
|
|
Print your first name
Use: [1]
|
|
|
|
Print each number from 0 to 14
Use: loops[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
|