a=[i*i for i in range(10) if i%2==0]
则执行语句 print(sum(a[1:-1]))后输出的结果为( )
①range(0, 7) ②range(1, 7) ③range(0, 7, 1)
④range(1,7,1) ⑤range(7,1,-1) ⑥range(7,0,-1)
①day=0
②limit=float (input(“请输入家长设定值(小时) :”))
③for i in range(7):
④ time=float(input(“请输入阅读时间(小时) :”))
⑤ if time>limit:
⑥ day=day+1
⑦print(“有”, day, “天阅读时间小于家长设定值”)
图1 预期结果
图2 调试结果
请写出出错的语句的编号,并写出修改后的语句: 。
Private Sub Command1_ Click( )
Dim a(0 To 4) As Integer, b(1 To 4) As Integer
Dim key As String, s As String, n As Integer, k As Integer, i As Integer, j As Integer, sum As Integer
key="ABCDEFGHJKIMNC)PQRSTUVWXYZabdefghijklmnopqrstuvwxyz0123456789! @# $ %&.*"
Randomize
n= Val(Text1.Text)
a(0)=0:a(1)=26 :a(2)=52 :a(3)=62:a(4)=70 '记录每种符号的结束位置
s= ""
For i=1 To 4
b(i) =0 'b数组记录某类符号是否使用
Next i
sum=4 '当前未使用字符类型,初始为4种
Do While Len(s)+sum< n
k= '随机选择一个密码序号
s=s+ Mid(key, k, 1)
i= 1
Do While
i=i+ 1
Loop
b(i)= 1
sum=4-b(1)-b(2)-b(3)-b(4)
'生成剩余未出现元素密码,保证4种符号均有出现
For i=1 To sum
j=Int(Rnd*4)十1
Do While ( )
j=j Mod 4+1
b(j)=1
k=Int(Rnd * (a(j)-a(j- 1)))+a(j-1)+1
s=s+Mid(key, k, 1)
Text2.Text=s
End Sub
a(1)=“ABC”:a(2)=“DEF”:a(3)=“GHI”
s1=“31,12,23,33”:s2=“”
For i = 1 To Len(s1)
ch = Mid(s1,i,1)
If ch < > “,” Then
i=i+1
p=Val(Mid(s1,i,1))
s2=s2+Mid(a(p),Val(ch),1)
End If
执行该程序段后,变量s2的值是( )