Code Writer
Level 3, 2026-11-15
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have 2 lists of numbers with 16 elements each: Q and X. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,...,16], X = [1,2,3,...,16] |
A rectangle has sides of 5 and 4. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
Use a loop to print the sum of the numbers from 1 to 11
Use: variables, loops[2]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Assume you have a list of numbers X. Write code to add up the numbers in the list that are smaller than 5
Use: variables, loops, if[3]
|
|
|
Test Using: X = [] X = [5,6,7,8,9,10,11,12,13,14,15] X = [66,87,57] |
Assume you have a list F with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: F = ['a','b','c'] F = ['big','dog'] F = [3,37,95] |
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 = 17 |
Print your first name
Use: [1]
|
|
|
|
|