Code Writer
Level 3, 2026-01-30
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 list of numbers E. Write code to add up the numbers in the list that are bigger than or equal to than 16
Use: variables, loops, if[3]
|
|
|
Test Using: E = [] E = [5,6,7,8,9,10,11,12,13,14,15] E = [68,8,61] |
Print your first name
Use: [1]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Print each number from 0 to 29
Use: loops[2]
|
|
|
|
Use a loop to print 14 lines with the numbers from 1 to 14 and each number times 20, separated by a commma.
For example, line 1 would be "1, 20", line 2 would be "2, 40",etc.
Use: variables, loops, str()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a variable VAR. If VAR is smaller than 6 add 2 to it, otherwise subtract 5 from it
Use: variables, if[2]
|
|
|
Test Using: VAR = 0 VAR = 6 VAR = 10 |
Use a loop to print 13 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]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
|