在线名词解释大全
专业、全面、易懂的全领域名词百科

9()Analyzethefollowingcode:classA:def__init__(self,s="Welcome"):self.s=sdefprint(self):print(self.s)a=A()a.print()

题型:单选题
选项
A. The program has an error because class A does not have a constructor.
B. The program has an error because s is not defined in print(s).
C. The program runs fine and prints nothing.
D. The program has an error because the constructor is invoked without an argument.
E. The program runs fine and prints Welcome.
正确答案:E