Code Writer
Level 3, 2026-07-30
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 letters F. Write code to count the number of times the letter "a" appears in the list.

Use: variables, loops, if[2]

Test Using:
F = []
F = ['a','a','z']
F = ['a','a','a']
A list contains a series of attacks on an enemy. The list looks like [1,2,3,1,1,2,...] where each element in the list is a number that means a type of attack:

1 is a light attack, taking 3HP
2 is a medium attack taking 6HP
3 is a strong attack taking 11HP

Write code to calculate the total amount of HP damage caused by all the attacks.

Use: variables, loops, if[3]

Test Using:
attacks = [1,2,3]
attacks = [1,2,3,3,2,1]
attacks = [33,8,28]
Print a variable that contains your first name

Use: variables[1]
Create two strings and join them together with a space between

Use: variables[1]
Assume you have a list of names, F. Write code to count the number of times the name "Julie" appears in the list.

Use: variables, loops, if[2]

Test Using:
F = []
F = ['Julie']
F = ['Julie','Jenny','Julie','Julie']
Assume you have a non-empty list E. Print the first element in the list.

Use: variables[1]

Test Using:
E = [1]
E = ['b','a','c']
E = [60,22,30]
Assume you have a list of letters Y. Write code to count the number of times the letter "d" appears in the list.

Use: variables, loops, if[2]

Test Using:
Y = []
Y = ['d','a','z']
Y = ['d','d','d']
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 = []
Print your first name

Use: [1]