Private Sub Command1_Click()
Dim x As Integer
x=Val(Text 1.Text)
Select Case
Case Is>=90
Text2.Text=“A”
Case Is>=80
Text2.Text=“B”
Case Is
Text2.Text=“C”
Case Is>=60
Text2. Text=“D”
Case Else
End Select
End Sub
If(a>b) Then
Print a ‘如果a>b,输出变量a的值
Else
Print b ‘否则,输出变量 b的值
End If ‘结束If分支
score=int (input ("请输入考试成绩"))
if score>=90:
print("A")
elif score>=80:
print("B")
elif score>=70:
print("C")
elif score>=60:
print("D")
else:
print("E")
若x中的值为2,4,6,则打印“x的值为2,4,6”;
若x中的值为10到20之间的数,则打印“x的值为10~20”;
若x中的值为大于20的数,则打印“x 的值大于20”;
否则,打印“x不在范围内”;
Private Sub Command1_Click()
x = Val(Text1.Text)
Select Case x
Case
Print "x的值为2,4,6"
Case
Print "x的值为10~20"
Case
Print "x的值大于20"
Print "x不在范围内"
End Select
End Sub
Private Sub Command1_Click()
Dim a As Single, b As Single
a = Val(Text1.Text)
b = 10
If a >= b
b = a * a + 2 * b
End If
Label1.Caption = Str(b)
End Sub
x=3
Select Case x
Case 5
Print "优秀"
Case 4
Print "良好"
Case 3
Print "通过"
Case Else
Print "不通过"
End Select
m=int(input("请输入一个整数:"))
if ⑴:
print("这个数字是奇数")
⑵:
print("这个数字是偶数")
⑴A.m/2=0 B.m//2==0 C.m%2=0 D.m%2==1
⑵A.if B.else C.elif D.break
height=input('你的身高是多少米:')
height=float(height)
weight =input('你的体重是多少KG:')
weight =float(weight)
BMI=weight/(height*height)
if BMI>=24.9:
print('肥胖')
① BMI<24.9 ② BMI>=18.5:
print('正常')
else:
print('偏瘦')
① ②
if a+b>c and a+c=b and b+c>a :
print(“周长:”,a+b+c)
else:
print(“不能构成三角形”)
s='t1Hr2a3'
s1='' ; s2=''; i = 0
while i < len(s):
if '0'<=s[i]<='9':
s1 = s1 + s[i]
elif 'a'<=s[i]<='z':
s2 = s[i] + s2
i = i + 1
ans = s2 + s1
print(ans)
程序执行后,输出的结果是( )
1)系统随机生成一个1~100的数字;
2)用户总共有5次猜数字的机会;
3)如果用户猜测的数字大于系统给出的数字,打印“too big";
4)如果用户猜测的数字小于系统给出的数字,打印"too small";
5)如果用户猜测的数字等于系统给出的数字,打印"恭喜",并且退出循环;
编写程序代码如下,请完善代码:
#导入random模块
#随机生成1-100的整数并赋值给变量game
time=5
while time>0:
guess=int (input ("请输入你所猜的数字:"))
if (guess>game) :
print ("too big")
elif :
print(" too small' )
else:
print ("恭喜”)
break
time=time-1
print("游戏结束,正确的结果是:",game)
a=int(input("请输入分数: ")) if a>=85: print("优秀") else: if a>=60 and a<85: print("良好") print("继续努力") else: print("待优") print("你需要加把劲了") |
m=19
if m>=30 or m<20:
print(m)