这段程序哪里出错了?

img

哪里出错了?
哪里出错了?我知道不打了VB空改回来了合肥公交看来

前面一个elif后面没写内容
可以加上一个缩进,后面pass

img


你这个4的语句呢?需要的话就写上语句,不需要这个elif就删掉

以下内容部分参考ChatGPT模型:


这段程序的错误在于使用了中文的注释符号“#”,应该使用英文的注释符号“#”。另外,程序中缺少了打印输出结果的语句,可以使用print()函数来实现。以下是修改后的程序:

# 计算1到100的和
sum = 0
for i in range(1, 101):
    sum += i
print(sum)

如果我的建议对您有帮助、请点击采纳、祝您生活愉快

  • 这个问题的回答你可以参考下: https://ask.csdn.net/questions/352992
  • 你也可以参考下这篇文章:VB运行后去除窗体标题栏且可改变窗口大小及移动窗体
  • 除此之外, 这篇博客: VB程序设计练习题(一)中的 三、用滚动条改变标签颜色 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • 答案:

     

    Private Sub HSB_Change()

    Text3.Text = HSB.Value

    Label4.BackColor = RGB(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))

    End Sub

     

    Private Sub HSB_Scroll()

    Text3.Text = HSB.Value

    Label4.BackColor = RGB(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))

    End Sub

     

    Private Sub HSG_Change()

    Text2.Text = HSG.Value

    Label4.BackColor = RGB(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))

    End Sub

     

    Private Sub HSG_Scroll()

    Text2.Text = HSG.Value

    Label4.BackColor = RGB(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))

    End Sub

     

    Private Sub HSR_Change()

    Text1.Text = HSR.Value

    Label4.BackColor = RGB(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))

     

    End Sub

     

    Private Sub HSR_Scroll()

    Text1.Text = HSR.Value

    Label4.BackColor = RGB(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))

    End Sub


  • 您还可以看一下 张景平老师的VB程序设计教程:从入门到精通课程中的 程序创建过程和案例三位数分离小节, 巩固相关知识点