Python中类的定义正确的是 A: class Phone: name = "" call(self, name) print(name, "打电话") B: class Phone: name = "" call(self, name) print(name, "打电话") C: class Phone: name = "" def call(self, name): print(name, "打电话") D: class Phone name = "" def call(self, name): print(name, "打电话")
Python中类的定义正确的是 A: class Phone: name = "" call(self, name) print(name, "打电话") B: class Phone: name = "" call(self, name) print(name, "打电话") C: class Phone: name = "" def call(self, name): print(name, "打电话") D: class Phone name = "" def call(self, name): print(name, "打电话")
以下代码中,实例方法定义正确的是() A: class Student: def setName(self,name): self.name=name B: class Student: def setName(name): self.name=name C: class Student: def setName(self): self.name=name D: class Student: def setName(name,self): self.name=name
以下代码中,实例方法定义正确的是() A: class Student: def setName(self,name): self.name=name B: class Student: def setName(name): self.name=name C: class Student: def setName(self): self.name=name D: class Student: def setName(name,self): self.name=name
以下有关类的声明,正确的是 A: class Student(object) def __init__(self, name, score): self.name = name self.score = score B: class Student(object) def __init__(self, name, score) self.name = name self.score = score C: class Student(object): def __init__(self, name, score): self.name = name self.score = score D: class Student(object): def __int__(self, name, score): self.name = name self.score = score
以下有关类的声明,正确的是 A: class Student(object) def __init__(self, name, score): self.name = name self.score = score B: class Student(object) def __init__(self, name, score) self.name = name self.score = score C: class Student(object): def __init__(self, name, score): self.name = name self.score = score D: class Student(object): def __int__(self, name, score): self.name = name self.score = score
下列的类属性的表示方法中()是私有属性。 A: self.name B: self.__name C: __name__ D: name
下列的类属性的表示方法中()是私有属性。 A: self.name B: self.__name C: __name__ D: name
{class Student:def __init__(self, name):self.name = namedef out(self):print('name:', self.name)终端应如何输入(创建实例)______、(调用方法)______,使其可以输出“name:王芳”}
{class Student:def __init__(self, name):self.name = namedef out(self):print('name:', self.name)终端应如何输入(创建实例)______、(调用方法)______,使其可以输出“name:王芳”}
class Student:def __init__(self,name,age):self.name=nameself.age=agedef fun1(self):print("hello")( )def fun2(self):print("yes")child=Child("Tom",20)child.fun1()
class Student:def __init__(self,name,age):self.name=nameself.age=agedef fun1(self):print("hello")( )def fun2(self):print("yes")child=Child("Tom",20)child.fun1()
( )不是 Python 合法标识符。 A: int B: 40XL C: _self D: name
( )不是 Python 合法标识符。 A: int B: 40XL C: _self D: name
()不是合法的Python标识符。 A: 40XL B: _self C: name D: int32
()不是合法的Python标识符。 A: 40XL B: _self C: name D: int32
class Person: def __init__(self,name):self.name=name def __str__(self):return "我的名字是"+self.nameperson=Person("小明")print(person)编译能通过吗,如果通过写出结果,否则写出失败原因
class Person: def __init__(self,name):self.name=name def __str__(self):return "我的名字是"+self.nameperson=Person("小明")print(person)编译能通过吗,如果通过写出结果,否则写出失败原因
写出输出结果:class Student: def __init__( self, name,age=18): self.name=name self.age=agestudent=Student("李强",21)print(student.age)
写出输出结果:class Student: def __init__( self, name,age=18): self.name=name self.age=agestudent=Student("李强",21)print(student.age)