组卷题库 > 高中信息技术试卷库
试题详情
有如下Python程序段:

a = [12, 8, 9, 18, 2, 19, 28, 6]

for i in range (len(a)-1):

    if a[i] < a[i+1]:

        a[i], a[i+1] = a[i+1], a[i]

p = len(a)-1

for i in range(len(a)-2, 0, -1) :

    if a[i] > a[p] :

        P =i

tmp = a[p]

a[p] = a[0]

a[0] = tmp

print (a)

执行该程序段后,输出的结果是(    )

A、[28,9,18,8,19,12,6,2]
B、[12,9,18,8,19,28,6,2]
C、[28,9,18,19,8,12,6,2]
D、[2,9,12,8,18,19,6,28]
知识点
参考答案
采纳过本试题的试卷
教育网站链接