Python 介绍,if 语句。无效的语法

马蒂库斯

大家好,我是新来的,也是 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: 之后收到无效的语法错误,不知道为什么。谁能简要解释一下我做错了什么?

感谢您的时间。

Miket25

在您的第一行,您缺少一个结束括号。

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()

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章