Code Writer
Level 3, 2026-04-21
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print your first name
Use: [1]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Write a loop that prints "dum" 64 times
Use: loops[2]
|
|
|
|
A right angled triangle has 2 shorter sides of 3 and 1. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Use a loop to multiply the numbers from 6 to 20
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers with 12 elements each: Q and Y. Add the 5th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,...,12], Y = [1,2,3,...,12] |
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 33!
Use: variables, loops, str()[2]
|
|
|
|
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 15 and another side of 7. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
|