Code Writer
Level 3, 2026-10-08
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
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 75!
Use: variables, loops, str()[2]
|
|
|
|
Create a list containing 3 numbers and then print each one
Use: variables, loops[2]
|
|
|
|
Assume you have a list of numbers E. Print the 10th element of E.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,4,5,6,7,8,9,10] |
Assume you have a non-empty list of numbers B. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [1,2,3] B = [3,2,1,0] B = [68,19,3] |
Assume you have a non-empty list of numbers VAR. Write code to find the biggest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: VAR = [1,2,3] VAR = [3,2,1,0] VAR = [68,19,3] |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Assume you have a list A with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: A = ['a','b','c'] A = ['big','dog'] A = [46,46,64] |
Use a loop to print the sum of the numbers from 0 to 2
Use: variables, loops[2]
|
|
|
|
Do the sum 69 - 84 in code and store the result
Use: variables[1]
|
|
|
|
|