以下函数定义正确的是 ( )
A: def x:return 1
B: def _x(): return 1
C: def !x(): return 1
D: def 求和(x, y): return x + y
A: def x:return 1
B: def _x(): return 1
C: def !x(): return 1
D: def 求和(x, y): return x + y
举一反三
- 给出下面代码的运行结果: def fun_1(x, y=3): x = x * 10 + y return fun_2(x) def fun_2(x): return x / 5 fun_1(6, 5)
- 下面程序的执行结果是: x=2 y=1 def fn(x): return x+y print(fn(4))
- 下面函数的执行结果是: x=1 def fn(x): x=3 return x+2 print(fn(x))
- 以下函数定义中,正确的是() A: def fun(x, y) B: def fun(x, y = 3.14) C: def fun(x, *y) D: def fun(*x, y)
- def exchange(a,b): a,b = b,a return (a,b) x = 10 y = 20 x,y = exchange(x,y) print(x,y)