Code Writer
Level 3, 2026-10-03
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Create a list containing 5 animals
Use: variables[1]
|
|
|
|
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print 81 lines with the numbers from 1 to 81 and each number times 8, separated by a commma.
For example, line 1 would be "1, 8", line 2 would be "2, 16",etc.
Use: variables, loops, str()[2]
|
|
|
|
Print each number from 0 to 21
Use: loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 3
Use: variables, loops[2]
|
|
|
|
Do the sum 71 + 47 and print the result
Use: [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 21!
Use: variables, loops, str()[2]
|
|
|
|
Print each number from 1 to 7
Use: loops[2]
|
|
|
|
Do the sum 91 - 33 and print the result
Use: [1]
|
|
|
|
|