以下有关字典说法正确的是:
A: d = {1:5, 2:8}print(len(d))输出值为:2
B: d = {1:5, 2:8}print(d.get(1,0))输出值为:5
C: d = {1:5, 2:8}print(d.get(3,0))输出值为:0
D: d = {1:5, 2:8}print(5 in d)输出值为:False
A: d = {1:5, 2:8}print(len(d))输出值为:2
B: d = {1:5, 2:8}print(d.get(1,0))输出值为:5
C: d = {1:5, 2:8}print(d.get(3,0))输出值为:0
D: d = {1:5, 2:8}print(5 in d)输出值为:False
举一反三
- 如下代码运行后的输出结果是()。 ls = list(range(6)) ls.append(8) print(ls) A: [1, 2, 3, 4, 5, 6, 8] B: [0, 1, 2, 3, 4, 5, 8] C: [8, 1, 2, 3, 4, 5, 6] D: [8, 0, 1, 2, 3, 4, 5]
- 下列各语句输出结果为True的是( )。 A: print(7<2) B: print(5>0) C: print((1>2)and(2>1)) D: print(2==0)
- 请阅读下面一段程序:arr = np.arange(6).reshape(1, 2, 3)print(arr.transpose(2, 0, 1))执行上述程序后,最终输出的结果为( )。 A: [[[2 5]][[0 3]][[1 4]]] B: [[[1 4]] [[0 3]] [[2 5]]] C: [[[0 3]][[1 4]][[2 5]]] D: [[[0] [3]][[1] [4]][[2] [5]]]
- 以下程序的输出结果是___________。for i in range(1,11): print(i, end = " ") A: 1 2 3 4 5 6 7 8 9 B: 1 2 3 4 5 6 7 8 9 10 C: 1 2 3 4 5 D: 1 3 5 7 9
- set1 = {x for x in range(10)} print(set1) 以上代码的运行结果为? A: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} B: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10} C: {1, 2, 3, 4, 5, 6, 7, 8, 9} D: {1, 2, 3, 4, 5, 6, 7, 8, 9,10}