下面代码的执行结果为( )。def f(values): values[0] = 44v = [1, 2, 3]f(v)print(v)
A: [1, 44]
B: [1, 2, 3, 44]
C: [44, 2, 3]
D: [1, 2, 3]
A: [1, 44]
B: [1, 2, 3, 44]
C: [44, 2, 3]
D: [1, 2, 3]
举一反三
- 下面代码的输出结果是什么? def f(value, values): v = 1 values[0] = 44 t = 3 v = [1, 2, 3] f(t, v) print(t, v[0]) A: 1 1 B: 1 44 C: 3 1 D: 3 44
- 以下代码的输出结果是什么? def f(i, values = []): values.append(i) return values f(1) f(2) v = f(3) print(v) A: [1] [2] [3] B: [1] [1, 2] [1, 2, 3] C: [1, 2, 3] D: 1 2 3
- 下面代码的运行结果是什么? values=[[3,4,5,1],[33,6,1,2]] v=values[0][0] forrowinrange(0,len(values)): forcolumninrange(0, len(values[row])): ifv values[row][column]: v = values[row][column] print(v) A: 1 B: 3 C: 5 D: 6 E: 33
- WhatwillbetheoutputofthefollowingPythoncode? [br][/br]values=[[3,4,5,1],[33,6,1,2]] [br][/br]v=values[0][0] [br][/br]forrowinrange(0,len(values)): [br][/br]----forcolumninrange(0,len(values[row])):[br][/br]--------ifv------------v=values[row][column] [br][/br]print(v) A: 3 B: 5 C: 6 D: 33
- 下面代码的执行结果是def change(mylist): mylist.append([1,2,3,4]) print(mylist) returnmylist = ["a","b","c"]change(mylist)print(mylist) A: ['a', 'b', 'c', [1, 2, 3, 4]]['a', 'b', 'c', [1, 2, 3, 4]] B: ['a', 'b', 'c', [1, 2, 3, 4]] C: ['a', 'b', 'c', 1, 2, 3, 4] D: ['a', 'b', 'c', 1, 2, 3, 4]['a', 'b', 'c', 1, 2, 3, 4]