Code Writer
Level 3, 2026-07-22
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have two non-empty lists of numbers VAR and Z. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: VAR = [1], Z = [1] VAR = [1,2,3], Z = [3,2,1] VAR = [41,85,1], Z = [64,26,67] |
Create a list containing 3 colors
Use: variables[1]
|
|
|
|
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.
Use: variables[2]
|
|
|
Test Using: S = 87 |
Assume you have a list of names, F. Write code to count the number of times the name "Julie" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: F = [] F = ['Julie'] F = ['Julie','Jenny','Felix','Julie'] |
Create a list containing 2 colors
Use: variables[1]
|
|
|
|
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of letters VAR. Write code to count the number of times the letter "a" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: VAR = [] VAR = ['a','a','z'] VAR = ['a','a','a'] |
Assume you have a non-empty list of scores VAR for your math class. Calculate the average of the scores.
Use: variables, loops[3]
|
|
|
Test Using: VAR = [10] VAR = [1,2,3,4,5] VAR = [24,9,69] |
Create a list containing 5 colors
Use: variables[1]
|
|
|
|
|