Code Writer
Level 3, 2026-02-11
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
A list contains a series of attacks on an enemy. The list looks like [1,2,3,1,1,2,...] where each element in the list is a number that means a type of attack:
1 is a light attack, taking 2HP 2 is a medium attack taking 6HP 3 is a strong attack taking 10HP
Write code to calculate the total amount of HP damage caused by all the attacks.
Use: variables, loops, if[3]
|
|
|
Test Using: attacks = [1,2,3] attacks = [1,2,3,3,2,1] attacks = [56,23,47] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Use a loop to add the numbers from 0 to 31
Use: variables, loops[2]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have a list Y with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: Y = ['a','b','c'] Y = ['big','dog'] Y = [38,50,82] |
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 = [] |
Use a loop to print the average of the numbers from 4 to 21
Use: variables, loops[2]
|
|
|
|
Assume you have a list of numbers X. Print the 10th element of X.
Use: variables[1]
|
|
|
Test Using: X = [1,2,3,4,5,6,7,8,9,10] |
Assume you have a list of numbers Y. Print the 4th element of Y.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,4,5,6,7,8,9,10] |
|