Code Writer
Level 3, 2026-02-14
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set two variables to different strings then make a new variable that combines them with a "g" in between
Use: variables[1]
|
|
|
|
Assume you have a list variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
Use a loop to add the numbers from 8 to 31
Use: variables, loops[2]
|
|
|
|
Print each number from 0 to 27
Use: loops[2]
|
|
|
|
Use a loop to print 61 lines with the numbers from 1 to 61 and each number times 19, separated by a commma.
For example, line 1 would be "1, 19", line 2 would be "2, 38",etc.
Use: variables, loops, str()[2]
|
|
|
|
Do the sum 87 / 82 and print the result
Use: [1]
|
|
|
|
Assume you have 2 lists of numbers with 7 elements each: E and A. Add the 7th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,...,7], A = [1,2,3,...,7] |
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 181HP. 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] |
Print your first name
Use: [1]
|
|
|
|
|