jackfrued / jackfrued/Python-100-Days

Day01-15-Day03-分支结构 练习2优化和练习5更新改

Open
#96 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

练习2优化

’‘’
from random import randint

face randint(1, 6)
result_dic={1:'唱首歌,2:跳个舞,3:学狗叫,4:做俯卧撑,5:念绕口令,6:讲冷笑话}

print(result_dic[face])

念绕口令
’‘’

练习5更新改

'''
【输入月收入和五险一金计算个人所得税】
个税计算公式
使用超额进税率的计算方法如下:
缴税=全月应纳税所得额*税率-速扣除数
实发工资应发工资-五险一金缴税
全月应纳税所得额=(应发工资-四金)-5000
扣除标准:个税按5000元/月的起征标准算
diff: 差异/等级收费标准
rate: 税率
deduction: 速算扣除数
tax: 应个人所得税
salary: 税前收入
insurance: 五险一金
'''.replace('\n',' ')

salary = float(input('本月收入:'))
insurance = float(input('五险一金:'))
diff = salary - insurance - 5000
if diff <= 0:
    rate = 0
    deduction = 0
elif diff < 3000:
    rate = 0.03
    deduction = 0
elif diff < 12000:
    rate = 0.1
    deduction = 210
elif diff < 25000:
    rate = 0.2
    deduction = 1410
elif diff < 35000:
    rate = 0.25
    deduction = 2660
elif diff < 55000:
    rate = 0.3
    deduction = 4410
elif diff < 80000:
    rate = 0.35
    deduction = 7160
else:
    rate = 0.45
    deduction = 15160

tax = abs(diff * rate - deduction)
print('个人所得税: ¥%.2f元' % tax)
print('实际到手收入:¥%.2f元' % (diff + 5000 - tax))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the Day01-15-Day03 branch-structure lesson content and review the sections for exercise 2 and exercise 5. Update the two exercise examples according to the issue, then verify that the Python snippets are correctly formatted and produce the intended output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
content, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.