Code Writer
Level 3, 2026-11-20
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 = [] |
Use a loop to print the average of the numbers from 6 to 22
Use: variables, loops[2]
|
|
|
|
Assume you have a variable E. If E is smaller than 3 add 8 to it, otherwise subtract 5 from it
Use: variables, if[2]
|
|
|
Test Using: E = 0 E = 3 E = 10 |
Print each number from 1 to 30
Use: loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
Use a loop to create a string that has 22 "a" characters
Use: variables, loops[2]
|
|
|
|
Use a loop to create a string that has 18 "c" characters
Use: variables, loops[2]
|
|
|
|
Assume you have a list of numbers Q. Print the 6th element of Q.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,4,5,6,7,8,9,10] |
|