python(1)

c = 2
k=3
a=1 if c>k else a=2
print(a)
a, b, c = 1, 2, 3
c = a if a>b else b
print(c)
for i in range(10):
    print(i)
    if(i==3):
        break
else :
    print('aaaaaaaa')
print('cccccccc')



r=eval(input("r="))
area=3.1415*r*r
print("area is :{:.60}".format(area))





a, b = 0, 1
while a < 1000:
    print(a, end=" ")
    a, b = b, a + b




from datetime import *
now=datetime.now();
print(now)
print(now.strftime("%x"))
print(now.strftime("%X"))



str1=input("请输入姓名:\n")
str2=input("请输入地名:\n")
print("{}这么大,{}aaa".format(str2,str1))


n=eval(input("N=\n"))
sum=0
for i in range(n+1):
    sum=sum+i
print(sum)

for i in range(1,10):
    for j in range(1,i+1):
        print("{}*{}={}".format(i,j,i*j),end=" ")
    print("\n")




t=1
sum=0
for i in range(1,4):
    t=t*i
    sum=sum+t
print(sum)
sum=1
for i in range(5,0,-1):
    sum=(sum+1)<<1
print(sum)
sum=46
for i in range(4):
    sum=sum/2-1
print(sum)




a=['A',"B",'C','D']
t=0
for i in range(0,4,1):
    for j in range(4):
        print("{},{}".format(i,j))
        t=t+1
        print(t)
        
        
        

def aa():
    temp = input("请输入温度:\n")
    if temp[-1] in ['f', 'F']:
        c = (eval(temp[0:-1]) - 32) / 1.8
        print(c)
    elif temp[-1] in ['c', "c"]:
        f = eval(temp[0:-1]) * 1.8 + 32
        print(f)
    else:
        print("error")
aa()




from turtle import *
setup(1200,1200,200,200)
fd(100)
seth(120)
fd(100)
seth(240)
fd(100)



from turtle import *
setup(1200,1200,200,200)
fd(100)
right(120)
fd(100)
right(120)
fd(100)



from turtle import *
setup(1200,1200,200,200)
fd(100)
left(120)
fd(100)
left(120)
fd(100)
left(120)
fd(50)



left(60)
fd(50)
left(120)
fd(50)
left(120)
fd(50)



from turtle import *
for i in range(4):
    penup()
    fd(50)
    pendown()
    fd(100)
    penup()
    fd(50)
    left(90)



from turtle import *
seth(30)
fd(200)
left(120)
fd(200)
left(120)
fd(200)
left(90)
t=(200/3)*pow(3,0.5)
penup()
fd(t)
pendown()
left(90)
fd(200)
left(120)
fd(200)
left(120)
fd(200)



from turtle import *
r=5
for i in range (100):
    fd(r)
    left(90)
    fd(r)
    left(90)
    r=r+3



import decimal
a=decimal.Decimal('2.34567890987654');
print(a*a)def dayy(day,t):
    for i in range(365):
        if i % 7 in [0, 6]:
            day = day * (1 - t)
        else:
            day = day * (1 + t)
    print("\t{:.2f}".format(day))
dayy(1.0,0.01)




if 0!=3.0:
    print("aaaaaa")
else:
    print("ddd")



import math
t=0.01
dayup=math.pow((1.0+t),365)
daydown=math.pow((1.0-0.1),365)
print("dayup:{:.2f}".format(dayup))
print("daydown:{:.2}".format(daydown))




a=1
b=2
print("{{{}{}}}".format(a,b))
print("{{{}}}{{{}}}".format(a,b))




import time
scale=50
print("start".center(scale//2,'-'))
t=time.clock()
for i in range(scale+1):
    a='*'*i
    b='.'*(scale-2)
    c=(i/scale)*100
    t-=time.clock()
    print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,-t),\
          end=' ')
    time.sleep(0.05)
print("\n"+"end!".center(scale//2,'-'))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值