Python 3.x Python简介,if语句。无效的语法

Python 3.x Python简介,if语句。无效的语法,python-3.x,Python 3.x,大家好,我是新来的,也是python的新手。我正在做一些我在网上找到的Python练习,我一直在思考我做错了什么。我试着学习和教自己关于if和else语句的知识。这是我的密码 weight = (float(input("How much does your suitcase weigh? ")) if weight > 50: print("There is a $25 fee for a luggage that heavy.") print("Thank you

大家好,我是新来的,也是python的新手。我正在做一些我在网上找到的Python练习,我一直在思考我做错了什么。我试着学习和教自己关于if和else语句的知识。这是我的密码

weight = (float(input("How much does your suitcase weigh? "))
if weight > 50:
          print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your buisness. ")

input()
50:之后,我收到一个无效的语法错误,但不确定原因。谁能简单地解释一下我做错了什么


谢谢你抽出时间

在第一行中,缺少一个结束括号

weight = (float(input("How much doees your suitcase weigh? ")))
if weight > 50 :
     print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your buisness. ")

input()

在第一行中,缺少一个结束括号

weight = (float(input("How much doees your suitcase weigh? ")))
if weight > 50 :
     print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your buisness. ")

input()

这个解决方案是正确的…实际上你有额外的括号

weight = (float(input( 
此代码也适用于:

weight = float(input("How much does your suitcase weigh? "))

if weight > 50:
    print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your business")

这个解决方案是正确的…实际上你有额外的括号

weight = (float(input( 
此代码也适用于:

weight = float(input("How much does your suitcase weigh? "))

if weight > 50:
    print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your business")

在任何编程语言中,您都需要知道如何打开/关闭括号

weight = (float(input( 
现在你有三个(()所以在结尾你也需要三个括号

weigh? ")))

在任何编程语言中,您都需要知道如何打开/关闭括号

weight = (float(input( 
现在你有三个(()所以在结尾你也需要三个括号

weigh? ")))

好吧,这很有道理。这很有效,我理解我的错误所在。谢谢你!@Matticus提示:如果你在一行中出现错误,看起来很好,通常意味着你错过了上面一行的括号。如果它解决了你的问题,请接受这个答案。谢谢你的提示,哎哟,我没有意识到这是支票的目的。好吧,mak这很有道理。这很有效,我也明白我把事情弄糟了。谢谢!@Matticus提示:如果你在一行中出现了错误,看起来很好,通常意味着你错过了上面一行的括号。如果这解决了你的问题,请接受这个答案。谢谢你的提示,哎哟,我不知道这是支票的目的。