下列关于Python中函数定义的代码正确的是?()
A: def say_hello: print(Hello)
B: def say_helloprint(Hello)
C: def say_hello: print(Hello)
D: def say_hello:print(Hello)
A: def say_hello: print(Hello)
B: def say_helloprint(Hello)
C: def say_hello: print(Hello)
D: def say_hello:print(Hello)
举一反三
- 从形式上看,以下python代码能够正确运行的是 A: def gcd(a,b): if b>a : a,b=b,a return b if a%b==0 else gcd(b,a%b)print(gcd(1000,750)) B: def a():print("Demo1!")a() C: def say(a_word): print(a_word)say("Hello!") D: int a(){ print("Hello ChunTian!"); return 0;}a();
- 定义类如下:class Hello(): def __init__(self,name): self.name=name def showInfo(self): print(self.name)下面代码能正常执行的 ( )。 A: h = Helloh.showInfo() B: h = Hello()h.showInfo('张三') C: h = Hello('张三')h.showInfo() D: h = Hello('admin')h.showInfo
- 下列代码的输出是( )。 >>> def greetPerson(*name): print('Hello', name) [br][/br] >>> greetPerson('Frodo', 'Sauron') A: Hello Frodo Hello Sauron B: Hello ('Frodo', 'Sauron') C: Hello Frodo D: Syntax Error! greetPerson() can take only one argument.
- 执行下述函数:def print_words():print('Hello ...nt_words()后,输出结果为( )
- 以下类的定义错误的是() A: class Stu: def Aa(self): print("aaaa") B: class Stu: a=10 C: class Stu: count=10; say(): print("Hello") D: class Stu: pass