Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
FullStackPark
Knowledge
Repository navigation
Code
Issues
2
(2)
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Knowledge
/
Python2-Example100
/
Exercise002.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
18 lines (17 loc) · 1.03 KB
master
Breadcrumbs
Knowledge
/
Python2-Example100
/
Exercise002.py
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
18 lines (17 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,
# 低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%;20万到40万之间时,高于20万元的部分,可
# 提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成
# 1.5%,高于100万元时,超过100万元的部分按1%提成,从键盘输入当月利润I,求应发放奖金总数?
#程序分析:请利用数轴来分界,定位。注意定义时需把奖金定义成长整型
i
=
int
(
raw_input
(
'净利润:'
))
#raw_input控制输入始终是字符串str类型
arr
=
[
1000000
,
600000
,
400000
,
200000
,
100000
,
0
]
#列表数组
rat
=
[
0.01
,
0.015
,
0.03
,
0.05
,
0.075
,
0.1
]
r
=
0
for
idx
in
range
(
0
,
6
):
if
i
>
arr
[
idx
]:
r
+=
(
i
-
arr
[
idx
])
*
rat
[
idx
]
print
(
i
-
arr
[
idx
])
*
rat
[
idx
]
i
=
arr
[
idx
]
print
r
You can’t perform that action at this time.