Code Writer
Level 3, 2026-04-02
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
A rectangle has sides of 6 and 8. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Use a loop to print 63 lines with the numbers from 1 to 63 and each number times 9, separated by a commma.
For example, line 1 would be "1, 9", line 2 would be "2, 18",etc.
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to add the numbers from 0 to 11
Use: variables, loops[2]
|
|
|
|
Assume you have a list of letters VAR. Write code to count the number of times the letter "b" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: VAR = [] VAR = ['b','a','z'] VAR = ['b','b','b'] |
Use a loop to create a string that has 25 "D" characters
Use: variables, loops[2]
|
|
|
|
A triangle has sides of 8, 8 and 3. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[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 44!
Use: variables, loops, str()[2]
|
|
|
|
Do the sum 81 + 50 and print the result
Use: [1]
|
|
|
|
|