给出下面程序的输出结果:x = -1y = 1def swap(a, b): t = a a = b b = t print a, bswap(x, y)print x, y
举一反三
- 下列程序的输出结果是:x = 1 y = 2 def swap(a, b): t = a a = b b = t print a, b swap(x, y) print x, y A: 1 21 2 B: 2 11 2 C: 1 22 1 D: 2 12 1
- def fun(x,y): global x,y t=x x=y y=t x=0 y=1 fun(x,y) print(x,y) 结果是 1 0
- 已知t函数定义如下,下列会输出True的语句是t = lambda x, y, z=0: x + y > z A: print(t(1, 2)) B: print(t(1, 2, 3)) C: print(t(1)) D: print(t(1, 2, 0))
- 判断下列程序输出的x的值是?(1),y的值是(2) x = "global" def foo(): global x y = "local" x = x * 2 print(x) print(y) foo()
- declare @x int,@y int,@t int set @x=1 set @y=2 begin set @t=@x set @x=@y set @y=@t end print @x