Code Writer
Level 3, 2026-07-28
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 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 = 62 |
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Assume you have a list of letters F. Write code to count the number of times the letter "c" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: F = [] F = ['c','a','z'] F = ['c','c','c'] |
Assume you have a list of numbers Y. Write code to count the number of times the number 90 appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Y = [90] Y = [0,90,-1,90,99,90] Y = [67,97,44] |
Assume you have a non-empty list of numbers Y. Create a new variable that is equal all the numbers in Y multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: Y = [1,1] Y = [1,2,3,4,5] Y = [52,91,74] |
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 = [] |
Assume you have a list of numbers Q. Print the 5th element of Q.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,4,5,6,7,8,9,10] |
Assume you have a non-empty list F. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: F = [1] F = ['a','b','c'] F = [27,31,72] |
Do the sum 40 + 83 and print the result
Use: [1]
|
|
|
|
|