15周 Python入门(人生苦短,我用Python)


for b in range(1,5):
    for s in range (1,5):
        for g in range (1,5):
            if b!=s and b!=g and s!=g:
                print b,s,g
  //=======================================================

# -*- coding:utf-8 -*-
sums=0.0
money=0.0
money=raw_input("输入奖金:")
# print "hello.%s"% money
money=int(money)
if money<=10:
    sums=money*0.1
elif money>10 and money <=20:
    sums=1+(money-10)*0.075
elif money>20 and money <=40:
    sums=1.75+(money-20)*0.05
elif money>40 and money <=60:
    sums=2.75+(money-40)*0.03
elif money>60 and money <=100:
    sums=3.35+(money-60)*0.015
else:
    sums=3.95+(money-100)*0.01
print "应发奖金为:"+ bytes(sums)

# -*- coding:utf-8 -*-
sums=0.0
money=0.0
money=raw_input("输入奖金:")
# print "hello.%s"% money
money=int(money)
if money<=10:
    sums=money*0.1
elif money>10 and money <=20:
    sums=1+(money-10)*0.075
elif money>20 and money <=40:
    sums=1.75+(money-20)*0.05
elif money>40 and money <=60:
    sums=2.75+(money-40)*0.03
elif money>60 and money <=100:
    sums=3.35+(money-60)*0.015
else:
    sums=3.95+(money-100)*0.01
print "应发奖金为:%f" % sums

//===================================================================


from math import sqrt
for i in range(9999999):
    temp=i+100
    temp2=int(sqrt(temp))
    if temp2*temp2==temp:
        temp=i+268
        temp2=int(sqrt(temp))
        if temp2*temp2==temp:
            print i

//=========================================================================
print("    *****   ")
print("   **     ")
print("  **       ")
print("  **       ")
print("   **      ")
print("    *****   ")


//======================================================================



/*
按公式PI/2 = ∑ (n! / (2n+1)!!) 计算Pi
计算2800项就可以精确到小数点后800位
*/
#include "stdio.h"
long b,c,d,e,f[2801];
int main()
{
  int i;
  for (i = 0; i < 2800; i++) 
  {
	  f[i] = 2000;
  }
  f[2800] = 0;
  for (c = 2800; c > 0; c -= 14) 
  {
    d = 0;
    for (b = c; b > 0; b--) 
    {
      d =d+ f[b] * 10000;
      f[b] = d % (2*b-1);
      d =d/(2*b-1);
      if (b > 1)
      d=d*(b-1);
    }
    printf("%.4d", e + d / 10000);
    e = d % 10000;
  }
  return 0;
}


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值