出自:广东开放大学数据分析与挖掘(本专)
下面代码的执行结果是 ( )。
list = [6, 4, 7, 2]
print(sorted(list), sorted(list, reverse = True))
选择一项:
a. [6, 4, 7, 2] [6, 4, 7, 2]
b. [7, 6, 4, 2] [2, 4, 6, 7]
c. [2, 4, 6, 7] [7, 6, 4, 2]
d. [7, 6, 4, 2] [7, 6, 4, 2]
下面代码输出的结果是 ( )。
s = ["A", "B", "C", "D", "E"]
print(s[1:4:1])
选择一项:
a. ["A", "B", "C"]
b. ["B", "C", "D"]
c. ["A", "B"]
d. ["C", "D","E"]
执行下面的代码,将会输出( )。
class Re:
def __init__(self, a, b):
self.a = a
self.b = b
def __str__(self):
return .Re (%d, %d). % (self.a, self.b)
def __add__(self,other):
return Re(self.a + other.a, self.b + other.b)
a = Re(5,6)
b = Re(7,8)
print (a + b)
选择一项:
a. Re (5, 6)
b. Re (12, 14)
c. Re (7, 8)
d. 以上选项都有误