Code Writer
Level 3, 2026-07-18
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 of names, E. Write code to count the number of times the name "Julie" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: E = [] E = ['Julie'] E = ['Julie','Felix','Octavian','Julie'] |
Print each number from 1 to 39
Use: loops[2]
|
|
|
|
Create a list containing 4 animals
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 = [] |
Create a list containing 5 animals and then print each one
Use: variables, loops[2]
|
|
|
|
Assume you have a variable VAR. If VAR is smaller than 7 add 3 to it, otherwise subtract 5 from it
Use: variables, if[2]
|
|
|
Test Using: VAR = 0 VAR = 7 VAR = 10 |
Assume you have a list of numbers Q. Print the 9th element of Q.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,4,5,6,7,8,9,10] |
Do the sum 52 + 67 in code and store the result
Use: variables[1]
|
|
|
|
A right angled triangle has 2 shorter sides of 1 and 3. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
|