Code Writer
Level 3, 2026-03-29
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 of names, F. Write code to count the number of times the name "Edward" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: F = [] F = ['Edward'] F = ['Edward','Julie','Felix','Edward'] |
A triangle has sides of 3, 8 and 7. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST and print the result.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Use a loop to create a string that has 26 "F" characters
Use: variables, loops[2]
|
|
|
|
Do the sum 65 + 98 and print the result
Use: [1]
|
|
|
|
Assume you have a list of numbers Z. Write code to add up the numbers in the list that are bigger than 8
Use: variables, loops, if[3]
|
|
|
Test Using: Z = [] Z = [5,6,7,8,9,10,11,12,13,14,15] Z = [22,25,7] |
Print each number from 1 to 26
Use: loops[2]
|
|
|
|
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 = [63,28,60] |
|