Code Writer
Level 3, 2026-10-18
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
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 = [] |
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have a list Z with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: Z = ['a','b','c'] Z = ['big','dog'] Z = [74,88,57] |
Assume you have a list of numbers F. Create a new variable that is equal to sum of all the numbers in F.
Use: variables, loops[2]
|
|
|
Test Using: F = [] F = [1,1] F = [97,18,46] |
Assume you have a non-empty list of numbers Y. Create a new variable that is equal all the numbers in Y multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: Y = [1,1] Y = [1,2,3,4,5] Y = [9,8,31] |
Write a loop that prints "dum" 47 times
Use: loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 2 to 13
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers with 13 elements each: F and Y. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: F = [1,2,3,...,13], Y = [1,2,3,...,13] |
Do the sum 28 + 78 and print the result
Use: [1]
|
|
|
|
Do the sum 84 - 68 in code and store the result
Use: variables[1]
|
|
|
|
|