Code Writer
Level 3, 2026-02-23
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Do the sum 56 - 33 and print the result
Use: [1]
|
|
|
|
A right angled triangle has 2 shorter sides of 6 and 2. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Assume you have 2 lists of numbers with 9 elements each: VAR and X. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,...,9], X = [1,2,3,...,9] |
Use a loop to add the numbers from 0 to 32
Use: variables, loops[2]
|
|
|
|
Create a list containing 5 fruit
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 1 to 20
Use: variables, loops[2]
|
|
|
|
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Create a function that duplicates a string. It has two arguments: the string to duplicate and a number that is how many times to duplicate. It returns the duplicated string. For example the string "dog" duplicated twice returns "dogodog".
Use: variables, functions[2]
|
|
|
Test Using: String = 'sus' String = '' String = 'hi you' |
A rectangle has sides of 8 and 8. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
|