Code Writer
Level 3, 2026-03-09
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. 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 = [] |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Create a list containing 2 colors
Use: variables[1]
|
|
|
|
Create a list containing 5 colors
Use: variables[1]
|
|
|
|
Assume you have a list of numbers F. Write code to count the number of times the number 48 appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: F = [48] F = [0,48,-1,48,99,48] F = [43,96,56] |
Assume you have a list variable LIST of numbers. Use a variable to add the items in the list
Use: variables, loops[2]
|
|
|
Test Using: LIST = [1] LIST = [1,2,3,4,5,6,7,8,9] LIST = [7,30,82] |
Use a loop to print 68 lines with a line number and the word "plop". For example, line 1 should be "1: plop", line 2 would be "2: plop", etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of names, B. Write code to count the number of times the name "Melissa" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [] B = ['Melissa'] B = ['Melissa','Missy','Jenny','Melissa'] |
Use a loop to print the sum of the numbers from 0 to 3
Use: variables, loops[2]
|
|
|
|
|