Code Writer
Level 3, 2026-09-20
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print each number from 1 to 21
Use: loops[2]
|
|
|
|
Create a list containing 5 animals
Use: variables[1]
|
|
|
|
Print your first name
Use: [1]
|
|
|
|
Assume you have 2 lists of numbers with 11 elements each: A and VAR. Add the 4th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: A = [1,2,3,...,11], VAR = [1,2,3,...,11] |
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 191HP. Write code that works out how much damage you have taken and prints "Dead" if you are killed.
Use: variables, loops, if[3]
|
|
|
Test Using: attacks = [1] attacks = [50,50,50] attacks = [1,1,1] |
Assume you have a non-empty list of scores VAR for your math class. Calculate the maximum of the scores.
Use: variables, loops[3]
|
|
|
Test Using: VAR = [10] VAR = [1,2,3,4,5] VAR = [53,28,89] |
Assume you have a list of letters A. Write code to count the number of times the letter "a" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: A = [] A = ['a','a','z'] A = ['a','a','a'] |
Print each number from 1 to 29
Use: loops[2]
|
|
|
|
|