Code Writer
Level 3, 2026-05-15
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]
|
|
|
|
Use a loop to create a string that has 33 "d" characters
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 187HP. 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 variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.
Use: variables[2]
|
|
|
Test Using: S = 67 |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Use a loop to add the numbers from 0 to 27
Use: variables, loops[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have a list of numbers VAR. Create a new variable that is equal to sum of all the numbers in VAR.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [] VAR = [1,1] VAR = [74,69,27] |
Assume you have two non-empty lists of numbers Y and B. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: Y = [1], B = [1] Y = [1,2,3], B = [3,2,1] Y = [59,6,84], B = [81,41,52] |
|