Code Writer
Level 3, 2026-07-08
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Write a loop that prints "dumdum" 17 times
Use: loops[2]
|
|
|
|
Assume you have a non-empty list of numbers X. Create a new variable that is equal all the numbers in X multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: X = [1,1] X = [1,2,3,4,5] X = [85,74,14] |
Assume you have a non-empty list A. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: A = [1] A = ['a','b','c'] A = [51,54,90] |
Use a loop to create a string that has 28 "A" characters
Use: variables, loops[2]
|
|
|
|
A right angled triangle has 2 shorter sides of 5 and 1. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Assume you have a list of letters Y. Write code to count the number of times the letter "E" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Y = [] Y = ['E','a','z'] Y = ['E','E','E'] |
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 = [] |
Set two variables to different strings then make a new variable that combines them with a "D" in between
Use: variables[1]
|
|
|
|
|