Code Writer
Level 3, 2026-10-10
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 1
Use: variables, loops[2]
|
|
|
|
Use a loop to print the sum of the numbers from 7 to 22
Use: variables, loops[2]
|
|
|
|
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 60!
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a non-empty list of scores E for your math class. Calculate the mean of the scores.
Use: variables, loops[3]
|
|
|
Test Using: E = [10] E = [1,2,3,4,5] E = [13,88,73] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Assume you have a non-empty list A. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: A = [1] A = ['a','b','c'] A = [32,88,72] |
Use a loop to print the average of the numbers from 8 to 21
Use: variables, loops[2]
|
|
|
|
|