Code Writer
Level 3, 2026-02-25
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 print 72 lines with a line number and the word "error". For example, line 1 should be "1: error", line 2 would be "2: error", etc.
Use: variables, loops, str()[2]
|
|
|
|
Print each number from 0 to 41
Use: loops[2]
|
|
|
|
Do the sum 92 - 46 and print the result
Use: [1]
|
|
|
|
Use a loop to print 81 lines with the numbers from 1 to 81 and each number times 15, separated by a commma.
For example, line 1 would be "1, 15", line 2 would be "2, 30",etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of numbers X. Write code to count how many numbers in the list are smaller than or equal to than 10
Use: variables, loops, if[3]
|
|
|
Test Using: X = [] X = [10,0,25] X = [58,36,79] |
Use a loop to create a string that has 35 "E" characters
Use: variables, loops[2]
|
|
|
|
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 60!
Use: variables, loops, str()[2]
|
|
|
|
Assume you have two non-empty lists of numbers F and X. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: F = [1], X = [1] F = [1,2,3], X = [3,2,1] F = [62,33,29], X = [28,67,40] |
|