Code Writer
Level 3, 2026-02-26
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to multiply the numbers from 9 to 22
Use: variables, loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 1
Use: variables, loops[2]
|
|
|
|
Assume you have a list of numbers B. Print the 9th element of B.
Use: variables[1]
|
|
|
Test Using: B = [1,2,3,4,5,6,7,8,9,10] |
Use a loop to print 46 lines with the numbers from 1 to 46 and each number times 4, separated by a commma.
For example, line 1 would be "1, 4", line 2 would be "2, 8",etc.
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to add the numbers from 1 to 13
Use: variables, loops[2]
|
|
|
|
Create a function that duplicates a string. It has two arguments: the string to duplicate and a number that is how many times to duplicate. It returns the duplicated string. For example the string "dog" duplicated twice returns "dogodog".
Use: variables, functions[2]
|
|
|
Test Using: String = 'sus' String = '' String = 'hi you' |
Create a list containing 5 animals and then print each one
Use: variables, loops[2]
|
|
|
|
Assume you have a variable E. If E is bigger than 8 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: E = 0 E = 5 E = 10 |
|