s = "Li20An24K04ao" ; i = 0
while i < len( s ) :
if "A" <= s[ i ] <= "Z" :
s = s[ : i ] + s[ i + 1 : ]
elif "0" <= s[ i ] <= "9" :
s = s[ : i ] + str( ( int(s[ i ]) + 8 ) % 10 ) + s[ i + 1 : ]
else :
s = s[ : i ] + chr( ( ord( s[ i ] ) – 95 ) % 26 + 97 ) + s[ i + 1 : ]
i = i + 1
执行上述程序后,s的值为( )
import random
a = [ 0 ] *5 ; i = 0 ; flag = True
while i < 5 :
a[ i ] = random.randint( 1 , 8 )
if i % 2 == 1 :
a[ i ] = a[ i ] + a[ i - 1 ]
flag = not flag
elif a[ i ] % 2 == 0 and flag == False:
i -= 1
i += 1
执行该程序段后,列表a的值不可能的是( )
while True:
t=pin0.read_analog()
if t>40:
display.show(Image.HAPPY)#在 LED 屏上点阵显示笑脸的图形
sleep(2000)
else:
display.show(Image.SAD)#在 LED 屏上点阵显示哭脸的图形
sleep(1000)
将代码烧录至某智能终端后运行,下列关于代码执行效果描述不正确的是( )
def p(x):
for i in range(2,x):
if x%i==0:
return False
return True
执行语句 print(p(5),p(6))后,输出的结果为( )
s,n=0,8
while True:
s+=n
if s>14:
break
n-=2
print(n,s)
执行程序后,输出结果可能是( )
s=input()
n=len(s);c=1;max=1
for i in range(1,n):
if (1)____:
c=c+1
if c>max:
max=c
else:
划线处可选代码为①c=1 ②c=0 ③s[i]<s[i+1] ④s[i]>s[i-1]
划线处正确的语句依次为( )