Code Writer
Level 3, 2026-07-14
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 variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
Use a loop to print 17 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]
|
|
|
|
A triangle has sides of 8, 8 and 7. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Use a loop to print the average of the numbers from 4 to 17
Use: variables, loops[2]
|
|
|
|
Create a list containing 5 animals
Use: variables[1]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have a non-empty list A. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: A = [1] A = ['a','b','c'] A = [25,43,19] |
Assume you have a non-empty list of scores F for your math class. Calculate the average of the scores.
Use: variables, loops[3]
|
|
|
Test Using: F = [10] F = [1,2,3,4,5] F = [95,84,14] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
|