Code Writer
Level 3, 2026-06-14
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 list of numbers Q. Write code to count the number of times the number 34 appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Q = [34] Q = [0,34,-1,34,99,34] Q = [14,94,91] |
A rectangle has sides of 2 and 5. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
Assume you have 2 lists of numbers with 9 elements each: Y and F. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,...,9], F = [1,2,3,...,9] |
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 62!
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
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 variable Q. If Q is bigger than 3 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: Q = 0 Q = 5 Q = 10 |
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
|