Code Writer
Level 3, 2026-08-02
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 variable S that is the length of the side of a square. Calculate another variable that is equal to the perimeter of the square.
Use: variables[2]
|
|
|
Test Using: S = 35 |
Use a loop to add the numbers from 5 to 34
Use: variables, loops[2]
|
|
|
|
Do the sum 91 / 69 and print the result
Use: [1]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have a variable Z. If Z is smaller than 5 add 8 to it, otherwise subtract 4 from it
Use: variables, if[2]
|
|
|
Test Using: Z = 0 Z = 5 Z = 10 |
Assume you have 2 lists of numbers with 14 elements each: A and VAR. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: A = [1,2,3,...,14], VAR = [1,2,3,...,14] |
Assume you have a list variable LIST of numbers. Use a variable to add the items in the list
Use: variables, loops[2]
|
|
|
Test Using: LIST = [1] LIST = [1,2,3,4,5,6,7,8,9] LIST = [25,0,35] |
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have 2 lists of numbers with 6 elements each: B and E. Add the 4th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: B = [1,2,3,...,6], E = [1,2,3,...,6] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
|