当前位置: 高中信息技术 / 单选题
  • 1. (2022高二上·温州期中) 有如下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]

微信扫码预览、分享更方便