一道python课习题,求解答 用switch

假设税前工资和税率如下(s代表税前工资,t代表税率):
s<1000 t=0%
1000<=s<2000 t=10%
2000<=s<3000 t=15%
3000<=s<4000 t=20%
4000<=s t=25%
编写一程序,要求用户输入税前工资额,然后用switch语句计算税后工资额。

python3.10有了,不过不是用switch做关键字,而是match

def get_tax(wages):
    match(wages):
        case x if x < 1000: tax = 0
        case x if 1000 <= x < 2000: tax = wages * 0.1
        case x if 2000 <= x < 3000: tax = wages * 0.15
        case x if 3000 <= x < 4000: tax = wages * 0.2
        case _: tax = wages * 0.25
    return tax

get_tax(800)
0
get_tax(8000)
2000.0
get_tax(3200)
640.0
get_tax(1800)
180.0
get_tax(2500)
375.0

python没有switch