Code Writer
Level 3, 2026-09-02
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 non-empty list B. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: B = [1] B = ['a','b','c'] B = [1,19,64] |
Assume you have 2 lists of numbers with 18 elements each: Z and E. Add the 8th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Z = [1,2,3,...,18], E = [1,2,3,...,18] |
Print each number from 2 to 18
Use: loops[2]
|
|
|
|
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','Octavian','Edward','Melissa'] |
Create a list containing 2 animals and then print each one
Use: variables, loops[2]
|
|
|
|
Print each number from 1 to 33
Use: loops[2]
|
|
|
|
Assume you have a non-empty list Z. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: Z = [1] Z = ['a','b','c'] Z = [1,19,64] |
A rectangle has sides of 5 and 9. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
Use a loop to add the numbers from 0 to 25
Use: variables, loops[2]
|
|
|
|
|