

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)
quantity = input("请输入苹果的数量:")
print(f"苹果的数量为:{quantity}")
添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)
apple_quantity = input("请输入苹果的数量:")
banana_quantity = input("请输入香蕉的数量:")
try:
total = int(apple_quantity) + int(banana_quantity)
print(f"苹果和香蕉的总数为:{total}")
except ValueError:
print("输入的不是有效的整数。")
添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)
try:
apple_quantity = int(input("请输入苹果的数量:"))
banana_quantity = int(input("请输入香蕉的数量:"))
total = apple_quantity + banana_quantity
print(f"苹果和香蕉的总数为:{total}")
except ValueError:
print("输入的不是有效的整数。")
添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)

添加图片注释,不超过 140 字(可选)
原文 | 译文 | 指向 |
|---|---|---|
Beautiful is better than ugly | 优美胜于丑陋 | 要优美 |
Explicit is better than implicit | 明了胜于晦涩 | 明了 |
Simple is better than complex | 简洁胜于复杂 | 简洁 |
Complex is better than complicated | 复杂胜于凌乱 | 若复杂不可避免保持接口简洁 |
Flat is better than nested | 扁平胜于嵌套 | 扁平的不要太多嵌套 |
Sparse is better than dense | 间隔胜于紧凑 | 适当间隔不奢望一行解决 |
Readability counts | 可读性很重要 | 可读才是好代码 |
Special cases aren't special enough to break the rules | 不可违背规则 | 规则重要 |
Although practicality beats purity | 虽然实践性胜过纯洁性 | 实践很重要 |
Errors should never pass silently | 错误必须处理 | 不放过异常不写 except:pass |
Unless explicitly silenced | 除非明确保持沉默 | 除非故意 |
In the face of ambiguity, refuse the temptation to guess | 不要让人猜测 | 明确 |
There should be one-- and preferably only one --obvious way to do it | 找最好的解决方案 | 精益求精 |
Although that way may not be obvious at first unless you're Dutch | 虽然这并不容易因为你不是 Python 之父 | 这里的 Dutch 是指 Guido |
Now is better than never | 做也许好过不做 | 实践出真知 |
Although never is often better than right now | 但不假思索就动手还不如不做 | 谋定而后动 |
If the implementation is hard to explain, it's a bad idea | 如果你无法向人描述你的方案那肯定不是一个好方案 | 好方法用容易描述 |
If the implementation is easy to explain, it may be a good idea | 容易解释,就是好的 | 说得清 才理解得透彻 |
Namespaces are one honking great idea -- let's do more of those! | 命名空间是一种绝妙的理念我们应当多加利用 | 多用名字空间 |

添加图片注释,不超过 140 字(可选)
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。