题目4单选题
What will be the output of the following Python code? a=[1,2,3] b=a.append(4) print(a) print(b)A. [1,2,3] [1,2,3,4]B. Syntax errorC. [1, 2, 3, 4] NoneD. [1,2,3,4] [1,2,3,4]
题目8单选题
Which of the following is not a valid way to define a dictionary in PythonA. d = {'foo': 100, 'bar': 200, 'baz': 300}B. d = dict([ ('foo', 100), ('bar', 200), ('baz', 300) ])C. d = {} d['foo'] = 100 d['bar'] = 200 d['baz'] = 300D. d = dict(foo=100, bar=200, baz=300)E. d = { ('foo', 100), ('bar', 200), ('baz', 300) }