Code Writer
Level 3, 2026-02-21
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 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 36!
Use: variables, loops, str()[2]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Assume you have a list of numbers A. Create a new variable that is equal to sum of all the numbers in A.
Use: variables, loops[2]
|
|
|
Test Using: A = [] A = [1,1] A = [67,31,31] |
Create a list containing 2 animals
Use: variables[1]
|
|
|
|
Assume you have a list variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
Assume you have a list of numbers E. Print the 5th element of E.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,4,5,6,7,8,9,10] |
Print each number from 5 to 9
Use: loops[2]
|
|
|
|
Assume you have a list of numbers VAR. Write code to add up the numbers in the list that are smaller than or equal to than 10
Use: variables, loops, if[3]
|
|
|
Test Using: VAR = [] VAR = [5,6,7,8,9,10,11,12,13,14,15] VAR = [31,32,95] |
|