Code Writer
Level 3, 2026-05-21
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 6 elements each: Y and B. Add the 5th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,...,6], B = [1,2,3,...,6] |
Use a loop to add the numbers from 0 to 29
Use: variables, loops[2]
|
|
|
|
Use a loop to print 51 lines with a line number and the word "dumb". For example, line 1 should be "1: dumb", line 2 would be "2: dumb", etc.
Use: variables, loops, str()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 6 to 16
Use: variables, loops[2]
|
|
|
|
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 = [] |
Assume you have a list of names, A. Write code to count the number of times the name "Octavian" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: A = [] A = ['Octavian'] A = ['Octavian','Edward','Flip','Octavian'] |
Print each number from 0 to 31
Use: loops[2]
|
|
|
|
Assume you have a non-empty list X. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: X = [1] X = ['a','b','c'] X = [2,5,21] |
|