Code Writer
Level 3, 2026-11-11
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 63!
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 7
Use: variables, loops[2]
|
|
|
|
Create a list containing 5 fruit
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 VAR. Create a new variable that is equal to sum of all the numbers in VAR.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [] VAR = [1,1] VAR = [90,22,50] |
Assume you have a variable B. If B is bigger than 3 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: B = 0 B = 5 B = 10 |
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Print each number from 0 to 16
Use: loops[2]
|
|
|
|
|