当前位置: 高中信息技术 / 单选题
  • 1. (2023·浙江模拟) 有如下Python程序段,运行后程序的输出结果是(   )

    a = [[3,1], [2,2], [3,3], [3,4], [17,5], [2,6], [3,-1]]

    p = head = 0

    while p != -1:

        q = p

        while q != -1:

            t = q

            q = a[q][1]

            if q != -1 and a[q][0] == a[p][0]:

                a[t][1] = a[q][1]

                q = t

        p = a[p][1]

    p = head

    while p != -1:

        print(a[p][0], end=' ')

        p = a[p][1]

    A . 3 2 17 B . 3 2 17 2 C . 3 2 17 2 3 D . 17

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