Code Writer
Level 3, 2026-08-10
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Create a list containing 2 colors
Use: variables[1]
|
|
|
|
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 = [54,20,56] |
A right angled triangle has 2 shorter sides of 6 and 4. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Assume you have a list of numbers Y. Print the 7th element of Y.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,4,5,6,7,8,9,10] |
Create a list containing 3 fruit and then print each one
Use: variables, loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 8
Use: variables, loops[2]
|
|
|
|
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 146HP. 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] |
Create a list containing 2 fruit
Use: variables[1]
|
|
|
|
Assume you have a non-empty list Y. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: Y = [1] Y = ['b','a','c'] Y = [86,45,42] |
|