Code Writer
Level 3, 2026-09-03
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 the average of the numbers from 4 to 23
Use: variables, loops[2]
|
|
|
|
Create a list containing 3 animals
Use: variables[1]
|
|
|
|
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 = [] |
Assume you have a non-empty list Y. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: Y = [1] Y = ['a','b','c'] Y = [86,41,42] |
Assume you have a list X with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: X = ['a','b','c'] X = ['big','dog'] X = [0,21,83] |
Assume you have a list of numbers Y. Create a new variable that is equal to sum of all the numbers in Y.
Use: variables, loops[2]
|
|
|
Test Using: Y = [] Y = [1,1] Y = [60,42,34] |
Assume you have a list A with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: A = ['a','b','c'] A = ['big','dog'] A = [0,21,83] |
Assume you have a list of names, Z. Write code to count the number of times the name "Flip" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Z = [] Z = ['Flip'] Z = ['Flip','Mongo','Octavian','Flip'] |
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 = [86,41,42] |
Use a loop to print 66 lines with the numbers from 1 to 66 and each number times 11, separated by a commma.
For example, line 1 would be "1, 11", line 2 would be "2, 22",etc.
Use: variables, loops, str()[2]
|
|
|
|
|