condition #11
Replies: 3 comments
-
计算收入税income = int(input('个人收入金额:'))
tax = 0
if income <= 100000:
tax = income * 0.10
elif income <= 500000:
tax = 100000 * 0.10 + (income - 100000) * 0.15
else:
tax = 100000 * 0.10 + 400000 * 0.15 + (income - 500000) * 0.20
print(f'应缴纳税金总数:{tax}') |
Beta Was this translation helpful? Give feedback.
0 replies
-
对三个数据排序a, b, c = 3.5, 1.2, 4.8
if a > b:
a, b = b, a
if a > c:
a, c = c, a
if b > c:
b, c = c, b
print("从小到大的顺序是:", a, b, c) |
Beta Was this translation helpful? Give feedback.
0 replies
-
判断三角形的三条边三角形的任意两条边边长之和都必须大于第三条边的边长: a, b, c = 3.5, 1.2, 4.8
if a + b > c and a + c > b and b + c > a:
print("这三个数可以组成三角形的三条边")
else:
print("这三个数不能组成三角形的三条边") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
condition
字符串和列表的处理通常离不开循环、条件等结构。虽然本书为了集中讲解相关内容,首先介绍了字符串和列表的各种操作方法,但对于初学者来说,更好的学习方式可能是先大致了解一下字符串和列表是什么样的数据。等到学习了循环结构后,再回头来学习这两种数据的复杂操作方法,会更容易理解。
https://py.qizhen.xyz/condition
Beta Was this translation helpful? Give feedback.
All reactions