Code Writer
Level 3, 2026-07-01
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
A triangle has sides of 9, 2 and 4. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Assume you have two non-empty lists of numbers F and A. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: F = [1], A = [1] F = [1,2,3], A = [3,2,1] F = [14,100,6], A = [19,70,49] |
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.
Use: variables[2]
|
|
|
Test Using: S = 29 |
Use a loop to print the sum of the numbers from 0 to 1
Use: variables, loops[2]
|
|
|
|
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 = [21,52,41] |
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Create a list containing 3 colors
Use: variables[1]
|
|
|
|
|