Code Writer
Level 3, 2026-02-16
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have a non-empty list Q. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: Q = [1] Q = ['b','a','c'] Q = [93,25,40] |
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to multiply the numbers from 3 to 14
Use: variables, loops[2]
|
|
|
|
Print each number from 1 to 39
Use: loops[2]
|
|
|
|
Assume you have a list VAR with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: VAR = ['a','b','c'] VAR = ['big','dog'] VAR = [55,88,94] |
Use a loop to print the sum of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
Use a loop to multiply the numbers from 1 to 29
Use: variables, loops[2]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the perimeter of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 30, T = 94 |
|