试题 试卷
题型:单选题 题类: 难易度:普通
新疆伊犁哈萨克自治州霍城县2023-2024学年高一上学期信息技术10月月考试卷
M=["l","2","4","3"]
M.sort( )
print( M)
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]
top-= 1
print(que[head:tail])
执行该程序段,则输出的结果是( )
a = [ 5 , 4 , 2 , 1 , 3 , 6 ] ; q = [ 0 ] * 6 ; head = tail = 0
for i in range( len( a ) ):
if a[ i ] % 2 == 1 :
q[ tail ] = a[ i ] ; tail = tail + 1
elif head < tail :
head += 1
print( tail – head )
执行该程序段后,输出结果为( )
试题篮