Code Writer
Level 3, 2026-09-08
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 create a string that has 9 "d" characters
Use: variables, loops[2]
|
|
|
|
Assume you have a variable Y. If Y is bigger than 5 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: Y = 0 Y = 5 Y = 10 |
Use a loop to multiply the numbers from 6 to 17
Use: variables, loops[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a variable Z. If Z is smaller than 7 add 7 to it, otherwise subtract 4 from it
Use: variables, if[2]
|
|
|
Test Using: Z = 0 Z = 7 Z = 10 |
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.
Use: variables[2]
|
|
|
Test Using: S = 80 |
Print each number from 0 to 10
Use: loops[2]
|
|
|
|
Assume you have 2 lists of numbers with 12 elements each: B and X. Add the 10th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: B = [1,2,3,...,12], X = [1,2,3,...,12] |
Assume you have a list VAR with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: VAR = ['a','b','c'] VAR = ['big','dog'] VAR = [81,75,20] |
|