Code Writer
Level 3, 2026-09-05
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have 2 lists of numbers with 7 elements each: Y and X. Add the 7th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,...,7], X = [1,2,3,...,7] |
Do the sum 24 / 24 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have a non-empty list of scores E for your math class. Calculate the mean of the scores.
Use: variables, loops[3]
|
|
|
Test Using: E = [10] E = [1,2,3,4,5] E = [81,72,74] |
Use a loop to add the numbers from 0 to 31
Use: variables, loops[2]
|
|
|
|
Use a loop to print 57 lines with a line number and the word "dumbdumb". For example, line 1 should be "1: dumbdumb", line 2 would be "2: dumbdumb", etc.
Use: variables, loops, str()[2]
|
|
|
|
Write a loop that prints "moo" 46 times
Use: loops[2]
|
|
|
|
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 1HP 2 is a medium attack taking 5HP 3 is a strong attack taking 9HP
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 = [49,65,93] |
Set two variables to different strings then make a new variable that combines them with a "F" in between
Use: variables[1]
|
|
|
|
|