Code Writer
Level 3, 2026-06-02
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 non-empty list of numbers Z. Write code to find the biggest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Z = [1,2,3] Z = [3,2,1,0] Z = [81,36,64] |
Assume you have a list of numbers A. Print the 9th element of A.
Use: variables[1]
|
|
|
Test Using: A = [1,2,3,4,5,6,7,8,9,10] |
Assume you have a list of letters B. Write code to count the number of times the letter "C" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [] B = ['C','a','z'] B = ['C','C','C'] |
Assume you have a list variable LIST of numbers. Use a variable to add the items in the list
Use: variables, loops[2]
|
|
|
Test Using: LIST = [1] LIST = [1,2,3,4,5,6,7,8,9] LIST = [53,92,87] |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
A right angled triangle has 2 shorter sides of 9 and 9. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Use a loop to print 38 lines with the numbers from 1 to 38 and each number times 18, separated by a commma.
For example, line 1 would be "1, 18", line 2 would be "2, 36",etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list F with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: F = ['a','b','c'] F = ['big','dog'] F = [20,80,20] |
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
|