您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 经营企划 > 最新python123练习题
精品文档精品文档HelloWorldIprint('HelloWorld')HelloWorldII(垂直)fornameinHelloWorld:print(name)N的多次方x=eval(input())foriinrange(5):print(pow(x,i),end='')print(pow(x,5))温度转换IITempStr=input()#print(eval(TempStr[1:]))ifTempStr[0]in['F','f']:C=(eval(TempStr[1:])-32)/1.8print(C{:.2f}.format(C))else:F=eval(TempStr[1:])*1.8+32print(F{:.2f}.format(F))货币转换Is=input()ifs[0]in['R','r']:精品文档精品文档u=eval(s[3:])/6.78print(USD{:.2f}.format(u))else:r=eval(s[3:])*6.78print(RMB{:.2f}.format(r))turtle正方形绘制importturtleturtle.setup(650,350,200,200)turtle.penup()turtle.fd(-250)turtle.pendown()turtle.pensize(2)turtle.pencolor(black)turtle.fd(50)foriinrange(3):turtle.left(90)turtle.fd(50)turtle.done()turtle六边形绘制importturtleturtle.setup(650,350,200,200)turtle.penup()turtle.fd(-250)精品文档精品文档turtle.pendown()turtle.pensize(2)turtle.pencolor(black)turtle.fd(50)foriinrange(5):turtle.left(60)turtle.fd(50)turtle.done()turtle叠边形绘制importturtleforiinrange(9):turtle.fd(100)turtle.left(80)turtle同切圆绘制importturtleturtle.setup(650,350,200,200)turtle.penup()turtle.pendown()turtle.pensize(2)turtle.pencolor(black)foriinrange(4):turtle.circle(30+10*i,360)精品文档精品文档长度转换Is=input()ifs[-1]in['m','M']:y=eval(s[:-1])*39.37print({:.3f}in.format(y))else:x=eval(s[:-2])/39.37print({:.3f}m.format(x))平方值格式化n=pow(eval(input()),2)iflen(str(n))20:print(n)else:print({0:-^20}.format(n))同符号数学运算n=eval(input())N=abs(n)a=N+10b=N-10c=N*10ifn0:a=-abs(a)b=-abs(b)精品文档精品文档c=-abs(c)else:a=abs(a)b=abs(b)c=abs(c)print(N,a,b,c,end=)天天向上的力量IIIn=eval(input())a=pow(1+(n/1000),365)b=pow(1-(n/1000),365)c=a/bprint({0:.2f},{1:.2f},{2:.0f}.format(a,b,int(c)),end=)星号三角形In=eval(input())p=int((n+1)/2)foriinrange(1,p+1,1):forjinrange(p-i):print(,end=)forkinrange(2*i-1):精品文档精品文档print(*,end=)forqinrange(p-i):print(,end=)print()恺撒密码Istrp=input()fori,cinzip(range(len(strp)),strp):ifc='a'andc='z':strp=strp[:i]+chr((ord(c)-ord('a')+3)%26+ord('a'))+strp[i+1:]else:continueprint(strp)祖国的问候print(祖国,您好!)print(我来了,学好Python。)热量转换I*精品文档精品文档
本文标题:最新python123练习题
链接地址:https://www.777doc.com/doc-4906952 .html