Code Writer
Level 3, 2026-02-26
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have a list variable LIST. Count the number of items in LIST and print the result.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 12 and another side of 5. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Set two variables to different strings then make a new variable that combines them with a "D" in between
Use: variables[1]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have a list of numbers B. Create a new variable that is equal to sum of all the numbers in B.
Use: variables, loops[2]
|
|
|
Test Using: B = [] B = [1,1] B = [100,62,44] |
Print each number from 1 to 13
Use: loops[2]
|
|
|
|
Assume you have a list of letters Q. Write code to count the number of times the letter "b" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Q = [] Q = ['b','a','z'] Q = ['b','b','b'] |
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 14 and another side of 6. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Set two variables to different strings then make a new variable that combines them with a "f" in between
Use: variables[1]
|
|
|
|
|