Code Writer
Level 3, 2026-08-04
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 non-empty list F. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: F = [1] F = ['b','a','c'] F = [24,69,80] |
Assume you have a variable B. If B is bigger than 6 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: B = 0 B = 5 B = 10 |
Assume you have a list of numbers Y. Print the 7th element of Y.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,4,5,6,7,8,9,10] |
Use a loop to multiply the numbers from 3 to 14
Use: variables, loops[2]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Assume you have a list of numbers F. Write code to count how many numbers in the list are bigger than 11
Use: variables, loops, if[3]
|
|
|
Test Using: F = [] F = [11,0,25] F = [30,71,37] |
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[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 = [] |
Assume you have a non-empty list VAR. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: VAR = [1] VAR = ['a','b','c'] VAR = [63,41,66] |
|