Code Writer
Level 3, 2025-07-02
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]
|
|
|
Assume you have a list of numbers Z. Create a new variable that is equal to sum of all the numbers in Z.
Use: variables, loops[2]
|
|
Test Using: Z = [] Z = [1,1] Z = [61,48,83] |
Assume you have a list of numbers Y. Create a new variable that is equal to sum of all the numbers in Y.
Use: variables, loops[2]
|
|
Test Using: Y = [] Y = [1,1] Y = [61,48,83] |
Print a list of strings, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
Use a loop to print 82 lines with a line number and the word "e". For example, line 1 should be "1: e", line 2 would be "2: e", etc.
Use: variables, loops, str()[2]
|
|
|
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 = [] |
Create a list containing 2 animals and then print each one
Use: variables, loops[2]
|
|
|
Assume you have a variable Y. If Y is bigger than 4 print "big", otherwise print "small"
Use: variables, if[2]
|
|
Test Using: Y = 0 Y = 5 Y = 10 |
|