下列Python代码,函数的定义和调用书写正确的是()
A: def test(a| b): print(a) print(b) test(1| 2)
B: def test(a): print(a) print(b) test(1, 2)
C: def test(a, b): print(a) print(b) test(1)
D: def test(a, b): print(a) print(b) test(1, 2)
A: def test(a| b): print(a) print(b) test(1| 2)
B: def test(a): print(a) print(b) test(1, 2)
C: def test(a, b): print(a) print(b) test(1)
D: def test(a, b): print(a) print(b) test(1, 2)
举一反三
- #print("Test")print("abc") #print("xyz")程序输出 A: Test<br/>abc xyz B: Test <br/>abc <br/>xyz C: abc D: abc xyz
- #print(“Test”)[br][/br]print(“abc”)#print(“xyz”)程序的输出结果是() A: Test <br>abcxyz B: abc C: abcxyz D: Test abc <br>xyz
- print(test())
- #print("Test") print("abc") #print("xyz") 程序输出
- 定义类如下:class Test():def __init__(self,name):self.name=namedef show(self):print(self.name)下面代码能正常执行的是 ( ) A: t = Test('张三')t.show() B: t = Test()t.show('张三') C: t = Test()t.show() D: t = Testt.show('张三')