有以下类的定义:class Car(object):def __init__(self, w, d):self.wheels = wself.doors = dself.color = ""问下列那句可以实现一个新的Car对象,具有4个轮子,两个门。
A. Car(mycar, 4, 2)
B. mycar = Car(4, 2, "white")
C. mycar = Car(4, 2)
D. mycar = Car(2, 4)
查看答案
基于以下定义:class Car(object):def __init__(self, w, d):self.wheels = wself.doors = dself.color = ""下列哪个方法改变车的颜色?()
A. def paint(c):color = c
B. def paint(self, c):color = c
C. def paint(c):self.c = c
D. def paint(self, c):self.color = c
有以下类的定义:class Car(object):def __init__(self, w, d):self.wheels = wself.doors = dself.color = ""def paint(self, c):self.color = c则创建了一个对象mycar = Car(4, 2)下列那条语句可以改变mycar的颜色为红色?
A. Car.paint("red")
B. mycar.paint(red)
C. mycar.paint("red")
D. mycar.paint(Car, "red")
以下程序的可能输出结果是:ss = set("htslbht")sorted(ss)for i in ss:print(i,end = '')
A. htslbht
B. tsblh
C. hslbht
D. hhlstt
已知id(ls1) = 4404896968,以下程序可能的输出结果是:ls1 = [1,2,3,4,5]ls2 = ls1ls3 = ls1.copy()print(id(ls2),id(ls3))
A. 4404896904 4404896904
B. 4404896968 4404896968
C. 44048969684404896904
D. 44048969044404896968