Code Writer
Level 3, 2026-10-05
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
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 33!
Use: variables, loops, str()[2]
|
|
|
|
Assume you have 2 lists of numbers that are the same size: F and B. Count how many times an element in F is equal to the element in the same position in B.
Use: variables, loops[2]
|
|
|
Test Using: F = [5], B = [5] F = [1,2,3], B = [3,2,1] F = [11,90,14], B = [41,44,38] |
Assume you have a non-empty list of numbers B. Create a new variable that is equal all the numbers in B multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: B = [1,1] B = [1,2,3,4,5] B = [20,89,89] |
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have a variable F. If F is smaller than 7 add 9 to it, otherwise subtract 2 from it
Use: variables, if[2]
|
|
|
Test Using: F = 0 F = 7 F = 10 |
Assume you have 2 lists of numbers with 10 elements each: E and VAR. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,...,10], VAR = [1,2,3,...,10] |
Use a loop to print 77 lines with a line number and the word "dumdum". For example, line 1 should be "1: dumdum", line 2 would be "2: dumdum", etc.
Use: variables, loops, str()[2]
|
|
|
|
Do the sum 88 / 91 in code and store the result
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
|