Code Writer
Level 3, 2026-04-26
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 A. If A is smaller than 2 add 8 to it, otherwise subtract 9 from it
Use: variables, if[2]
|
|
|
Test Using: A = 0 A = 2 A = 10 |
Assume you have a list of numbers F. Create a new variable that is equal to sum of all the numbers in F.
Use: variables, loops[2]
|
|
|
Test Using: F = [] F = [1,1] F = [0,48,65] |
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 6
Use: variables, loops[2]
|
|
|
|
Write a loop that prints "diddles" 58 times
Use: loops[2]
|
|
|
|
Assume you have a non-empty list F. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: F = [1] F = ['b','a','c'] F = [17,29,61] |
Use a loop to multiply the numbers from 1 to 16
Use: variables, loops[2]
|
|
|
|
Print your first name
Use: [1]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
|