Code Writer
Level 3, 2026-04-14
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print each number from 0 to 34
Use: loops[2]
|
|
|
|
Assume you have a non-empty list Z. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: Z = [1] Z = ['b','a','c'] Z = [55,18,13] |
Print your first name
Use: [1]
|
|
|
|
Use a loop to print 41 lines with a line number and the word "dum". For example, line 1 should be "1: dum", line 2 would be "2: dum", etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have 2 lists of numbers with 8 elements each: E and Q. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,...,8], Q = [1,2,3,...,8] |
Assume you have two non-empty lists of numbers Y and VAR. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: Y = [1], VAR = [1] Y = [1,2,3], VAR = [3,2,1] Y = [38,34,84], VAR = [47,18,28] |
Assume you have a non-empty list of numbers B. Create a new variable that is equal all the numbers in B multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: B = [1,1] B = [1,2,3,4,5] B = [70,26,52] |
Set two variables to different values then add them together
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 = [40,51,20] |
Assume you have a non-empty list of scores Q for your math class. Calculate the mean of the scores.
Use: variables, loops[3]
|
|
|
Test Using: Q = [10] Q = [1,2,3,4,5] Q = [17,70,54] |
|