Code Writer
Level 3, 2026-04-05
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of numbers Y. Write code to count how many numbers in the list are smaller than 2
Use: variables, loops, if[3]
|
|
|
Test Using: Y = [] Y = [2,0,25] Y = [39,86,22] |
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 = [] |
Use a loop to create a string that has 27 "A" characters
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers with 12 elements each: X and Z. Add the 9th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: X = [1,2,3,...,12], Z = [1,2,3,...,12] |
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 15 and another side of 2. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
|