Code Writer
Level 3, 2026-11-13
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print the sum of the numbers from 5 to 16
Use: variables, loops[2]
|
|
|
|
Assume you have a list of names, Q. Write code to count the number of times the name "Flip" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Q = [] Q = ['Flip'] Q = ['Flip','Octavian','Mongo','Flip'] |
Assume you have a list of names, Q. Write code to count the number of times the name "Felix" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Q = [] Q = ['Felix'] Q = ['Felix','Flip','Octavian','Felix'] |
Assume you have 2 lists of numbers with 16 elements each: F and Z. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: F = [1,2,3,...,16], Z = [1,2,3,...,16] |
Assume you have 2 lists of numbers with 18 elements each: Z and A. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Z = [1,2,3,...,18], A = [1,2,3,...,18] |
Assume you have a list variable LIST. Count the number of items in LIST and print the result.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Create a list containing 4 animals and then print each one
Use: variables, loops[2]
|
|
|
|
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have 2 lists of numbers with 18 elements each: E and B. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,...,18], B = [1,2,3,...,18] |
|