Code Writer
Level 3, 2025-10-17
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 multiply the numbers from 1 to 28
Use: variables, loops[2]
|
|
|
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 = [] |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
Assume you have a list of numbers X. Write code to count the number of times the number 11 appears in the list.
Use: variables, loops, if[2]
|
|
Test Using: X = [11] X = [0,11,-1,11,99,11] X = [27,30,44] |
Set two variables to different strings then make a new variable that combines them with a "C" in between
Use: variables[1]
|
|
|
Create a function that duplicates a string. It has two arguments: the string to duplicate and a number that is how many times to duplicate. It returns the duplicated string. For example the string "dog" duplicated twice returns "dogodog".
Use: variables, functions[2]
|
|
Test Using: String = 'sus' String = '' String = 'hi you' |
Use a loop to multiply the numbers from 8 to 23
Use: variables, loops[2]
|
|
|
Assume you have a non-empty list A. Print the first element in the list.
Use: variables[1]
|
|
Test Using: A = [1] A = ['b','a','c'] A = [7,59,80] |
Assume you have a variable A. If A is bigger than 5 print "big", otherwise print "small"
Use: variables, if[2]
|
|
Test Using: A = 0 A = 5 A = 10 |
|