当前位置: 高中信息技术 / 单选题
  • 1. (2023·浙江模拟) 已知字符“a ”的 ASCII 码值为 97,有如下 Python  程序段:

    que=[""]*20

    head,tail= 0,0

    for i in range(3):

        que[tail]=chr(97+i)

        tail+= 1

    st=["b","c","d","a"]

    top=3

    while head < tail and top > - 1:

        if st[top]==que[head]:

            head+= 1

        else:

            que[tail] = st[top]

            tail+= 1

        top-= 1

    print(que[head:tail])

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

    A . ['c', 'd', 'c'] B . ['c', 'c', 'd'] C . ['c', '', 'd'] D . ['c', 'd']

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