Code Writer
Level 3, 2026-09-19
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print your first name
Use: [1]
|
|
|
|
Use a loop to print 20 lines with the numbers from 1 to 20 and each number times 2, separated by a commma.
For example, line 1 would be "1, 2", line 2 would be "2, 4",etc.
Use: variables, loops, str()[2]
|
|
|
|
A right angled triangle has 2 shorter sides of 6 and 7. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
A right angled triangle has 2 shorter sides of 2 and 1. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
A triangle has sides of 7, 2 and 4. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Assume you have 2 lists of numbers that are the same size: Y and F. Count how many times an element in Y is bigger than the element in the same position in F.
Use: variables, loops[2]
|
|
|
Test Using: Y = [5], F = [5] Y = [1,2,3], F = [3,2,1] Y = [95,95,2], F = [56,39,43] |
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 = [] |
Use a loop to print 23 lines with a line number and the word "nose". For example, line 1 should be "1: nose", line 2 would be "2: nose", etc.
Use: variables, loops, str()[2]
|
|
|
|
|