Dim a(1 To 100) As Integer
Dim m As Integer, n As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer, x As Integer
Dim s As String
m = Val(Text1.Text)
n = Val(Text2.Text)
Randomize
For i = 1 To m
For j = 1 To n
x = Int(Rnd * 10 + 1)
Next j
Next i
s = ""
For i = 1 To m * n
s = s + Str(a(i))
If i Mod n = 0 Then
List1.AddItem s
End If
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, x As Integer, y As Integer
Dim key As Integer, flag As Boolean
key = Val(Text3.Text): flag = False
For i = 1 To m * n
If key = a(i) Then
x = (i - 1) \ n + 1
y =
list2.AddItem Str(key) + "的坐标为:第" + Str(x) + "行,第" + Str(y) + "列"
flag = True
End If
Next i
If Not flag Then
list2.AddItem "未查找到相应数据!"
End If
End Sub
,查找数据为3,则在列表框List2中显示内容是。
s="D5u6p@1_2t3B" num=0
for i in s[::-1]:
if "a"<=i<="z" or "A"<=i<="Z" or "0"<=i<="9":
if "0"<=i<="9":
num=num*10+int(i)
else:
break print(num)
该部分程序段运行后,变量 num 的值是( )
运行输出结果是:
图a
图b
Private Sub Command1_Click()
Dim n As Integer, i As Integer, s As Integer, x As Integer, f As Boolean
n = Val(Text1.Text)
f = False: s = 0
i = 2
Do While f = False
x = 2
Do While x <= Int(Sqr(i)) And i Mod x <> 0
①
Loop
If x > Int(Sqr(i)) Then
s = s + 1
If ② Then
Label2.Caption = "第" & Str(n) & "个素数是:" & Str(i)
f = True
End If
End If
i = i + 1
Loop
End Sub
① ②
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_excel("成绩表.xlsx")
print(df1)
划线处的代码应为 (单选,填字母)
请在划线处填写合适的代码。
num=int(input("请输入小组:"))
plt.figure(figsize=(10,5))
list=[]
for i in range(12):
s="题"+str(i+1)
list.append(df1.at[num,s]*50)
plt.bar(range(1,13),list)
plt.title(str(num)+" ")
plt.xlabel("question number")
plt.ylabel("correct rate")
plt.show()