Code Writer
Level 3, 2026-02-17
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print 26 lines with a line number and the word "dumb". For example, line 1 should be "1: dumb", line 2 would be "2: dumb", etc.
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a list of numbers X. Write code to count how many numbers in the list are bigger than 4
Use: variables, loops, if[3]
|
|
|
Test Using: X = [] X = [4,0,25] X = [67,70,55] |
Assume you have a list variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
A right angled triangle has 2 shorter sides of 8 and 8. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Use a loop to add the numbers from 1 to 29
Use: variables, loops[2]
|
|
|
|
Assume you have a non-empty list of numbers F. Create a new variable that is equal all the numbers in F multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: F = [1,1] F = [1,2,3,4,5] F = [53,23,58] |
Assume you have a non-empty list X. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: X = [1] X = ['a','b','c'] X = [0,61,25] |
|