Code Writer
Level 3, 2026-04-12
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: VAR and X. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,...,16], X = [1,2,3,...,16] |
A rectangle has sides of 3 and 2. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Do the sum 94 + 25 and print the result
Use: [1]
|
|
|
|
Assume you have a list of numbers B. Write code to add up the numbers in the list that are smaller than or equal to than 9
Use: variables, loops, if[3]
|
|
|
Test Using: B = [] B = [5,6,7,8,9,10,11,12,13,14,15] B = [51,14,57] |
Assume you have a list of numbers X. Write code to count how many numbers in the list are bigger than or equal to than 6
Use: variables, loops, if[3]
|
|
|
Test Using: X = [] X = [6,0,25] X = [87,44,24] |
Assume you have a list of names, F. Write code to count the number of times the name "Melissa" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: F = [] F = ['Melissa'] F = ['Melissa','Mongo','Missy','Melissa'] |
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the perimeter of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 97, T = 39 |
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
|