Code Writer
Level 3, 2026-06-28
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 66 lines with a line number and the word "diddles". For example, line 1 should be "1: diddles", line 2 would be "2: diddles", etc.
Use: variables, loops, str()[2]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Set two variables to different strings then make a new variable that combines them with a "A" in between
Use: variables[1]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 5
Use: variables, loops[2]
|
|
|
|
A right angled triangle has 2 shorter sides of 7 and 4. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Use a loop to print the average of the numbers from 4 to 15
Use: variables, loops[2]
|
|
|
|
Assume you have a list Y with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: Y = ['a','b','c'] Y = ['big','dog'] Y = [75,9,68] |
Assume you have a list variable LIST. Count the number of items in LIST and print the result.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
|