跳至正文
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
小奥的学习笔记

万丈高楼平地起,勿在浮沙筑高台

小奥的学习笔记

万丈高楼平地起,勿在浮沙筑高台

  • 首页
  • Sample Page
  • 隐私策略
  • GuestBook
  • 慕课课程(MOOC’s Lessons)
  • Footprints
  • About Me
  • 个人履历
  • 首页
  • Sample Page
  • 隐私策略
  • GuestBook
  • 慕课课程(MOOC’s Lessons)
  • Footprints
  • About Me
  • 个人履历
关

搜索

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
Python

编程语言入门经典100例【Python版】(转载自:ZH奶酪)

作者 yszhang
2017年10月19日 1 分钟阅读
0

【程序1】

题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?

#Filename:001.py
cnt = 0#count the sum of result
for i in range(1,5):
    for j in range(1,5):
        for k in range(1,5):
            if i!=j and i!=k and j!=k:
                print i*100+j*10+k
                cnt+=1
print cnt

题目:企业发放的奖金根据利润提成。利润(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,求应发放奖金总数?

#Filename:002.py
  i = int(raw_input('Enter the profit:'))
  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


作者

yszhang

关注我
其他文章
上一个

Python chapter 11 learning notes

下一个

随机漫步模型之python实现

暂无评论!成为第一个。

发表回复 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注

Copyright 2026 — 小奥的学习笔记. All rights reserved. Blogsy WordPress Theme