This assessment is designed to test a students prior knowledge of Python.
a) def variable(a):
b) a = 5
c) a == 5
d) a = 5;
a) ello W
b) llo
c) llo Wo
d) lo Wo
a) ['a', 'b', 12, 'a', 'b', 12, 'a', 'b', 12, 'a', 'b', 12, 'a', 'b', 12]
b) ['aaaaa', 'bbbbb', 60]
c) [['a','b',12],['a','b',12],['a','b',12],['a','b',12],['a','b',12]]
d) list*5 produces an error because you can't multiply an int by a mixed array.
import numpy
a = numpy.array([1,2,3,4,5])
for i in range(len(a)):
b = i*a
print(b)
a) A header file
b) A program
c) A reference to a file called numpy on the computer
d) A package
a) 0, 1, 2, 3, 4
b) 1, 2, 3, 4, 5
c) i does not change
d) [1, 2, 3, 4, 5]
a) Would not work. You need an array for multiplication to work.
b) [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
c) [ 4 8 12 16 20]
d) [1, 2, 3, 4, 5]
a) [50,41,330,26,12]
b) Not possible.
c) [12,26,330,41]
d) 50
a) No error. Apple is assigned the variable banana.
b) ValueErrror
c) SyntaxError
d) NameError
e) SyntaxError
a) list
b) array
c) dictionary
d) tuple
a) "This code will",work
b) "This code will"+"work"
c) This code will work
d) "This+code+will+work"