下面代码的执行结果是def exchange(a,b): a,b = b,a return (a,b)x = 10y = 20x,y = exchange(x,y)print(exchange(x,y))
A: (10, 20)
B: (20, 10)
C: 10, 20
D: 20, 10
A: (10, 20)
B: (20, 10)
C: 10, 20
D: 20, 10
A
举一反三
- 写出下面代码的运行结果( )def exchange(a,b): return (b,a)x = 10y = 20x,y = exchange(x,y)print((x,y)) A: 10 20 B: 20 10 C: (20, 10) D: (10, 20)
- 下面代码的输出结果是()。def exchange(a,b): a,b = b,a return (a,b)x = 10y = 20x,y = exchange(x,y)print(x,y) A: 20 20 B: 10 10 C: 20 10 D: 20,10
- def exchange(a,b): a,b = b,a return (a,b)x = 10y = 20x,y = exchange(x,y)print(x,y) A: 20,10 B: 20 20 C: 10 10 D: 20 10
- 下面代码的输出结果是 def exchange(a,b): a,b = b,a return (a,b) x = 10 y = 20 x,y = exchange(x,y) print(x,y) A: 20 10 B: 20 20 C: 10 20 D: 10 10
- 下面代码的输出结果是( ).def exchange(a, b):a, b = b, areturn(a,b)x = 10y = 20x, y = exchange(x, y)print(x, y) A: 20 10 B: 20,10 C: 10 10 D: 20 20
内容
- 0
def exchange(a,b): a,b = b,a return (a,b) x = 10 y = 20 x,y = exchange(x,y) print(x,y)
- 1
中国大学MOOC: 下面代码的输出结果是def exchange(a,b): a,b = b,a return (a,b)x = 10y = 20x,y = exchange(x,y)print(x,y)
- 2
def f1 (a, b): global x,y x,y=b, a return a,b x,y=10,20 print(x,y) print(f1(x,y)) print(x,y) 第二和第三个 print函数分别输出的结果是() A: (2,1) 20 10 B: (10,20) 20 10 C: (20,10) 2 1 D: (1,2) 20 10
- 3
下面代码的BIG= lambda x,y :(x>y) * x+(x<y) * ySM= lambda x,y: (x>y) * y+(x<y) * xa=10b=20print(BIG(a,b),SM(a,b))输出结果是( ) A: 10 10 B: 20 20 C: 20 10 D: 10 20
- 4
代码:```MA = lambda x,y : (x > y) * x + (x < y) * yMI = lambda x,y : (x > y) * y + (x < y) * xa = 10b = 20print(MA(a,b),MI(a,b))```上述代码的输出结果是:( ) A: 20 20 B: 10 10 C: 20 10 D: 10 20