Code Writer
Level 3, 2026-08-23
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have 2 lists of numbers with 9 elements each: F and Y. Add the 9th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: F = [1,2,3,...,9], Y = [1,2,3,...,9] |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have a variable F. If F is bigger than 2 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: F = 0 F = 5 F = 10 |
Assume you have a non-empty list of numbers B. Write code to find the biggest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [1,2,3] B = [3,2,1,0] B = [95,13,0] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 76!
Use: variables, loops, str()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a list of numbers E. Write code to count how many numbers in the list are smaller than 11
Use: variables, loops, if[3]
|
|
|
Test Using: E = [] E = [11,0,25] E = [66,17,12] |
Assume you have a non-empty list VAR. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: VAR = [1] VAR = ['b','a','c'] VAR = [12,26,81] |
Assume you have 2 lists of numbers with 12 elements each: Y and A. Add the 10th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,...,12], A = [1,2,3,...,12] |
|