赞
踩
python123练习题
Hello World I print( Hello World ) Hello World II(垂直) for name in "Hello World": print(name) N的多次方 x = (()) for i in range(5): print(pow(x, i), end = ) print(pow(x,5)) 温度转换 II TempStr = () #print((TempStr[1:])) if TempStr[0] in [ F , f ]: C = ((TempStr[1:]) - 32) / 1.8 print("C{:.2f}".at(C)) else : F = (TempStr[1:]) * 1.8 + 32 print("F{:.2f}".at(F)) 货币转换 I s = () if s[0] in [ R , r ]: u = (s[3:]) / 6.78 print("USD{:.2f}".at(u)) else: r = (s[3:]) * 6.78 print("RMB{:.2f}".at(r)) turtle正方形绘制 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.fd(-250) turtle.pendown() turtle.pensize(2) turtle.pencolor("black") turtle.fd(50) for i in range(3): turtle.left(90) turtle.fd(50) turtle.done() turtle六边形绘制 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.fd(-250) turtle.pendown() turtle.pensize(2) turtle.pencolor("black") turtle.fd(50) for i in range(5): turtle.left(60) turtle.fd(50) turtle.done() turtle叠边形绘制 import turtle for i in range(9): turtle.fd(100) turtle.left(80) turtle同切圆绘制 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.pendown() turtle.pensize(2) turtle.pencolor("black") for i in range(4): turtle.circle(30 + 10 * i, 360) 长度转换 I s = () if s[-1] in [ m , M ]: y = (s[:-1]) * 39.37 print("{:.3f}in".at(y)) else: x = (s[:-2]) / 39.37 print("{:.3f}m".at(x)) 平方值格式化 n = pow((()), 2) if len(str(n)) > 20: print(n) else: print("{0:-^20}".at(n)) 同符号数学运算 n = (()) N = abs(n) a = N + 10 b = N - 10 c = N * 10 if n = a and c <= z : strp = strp[:i] + chr((ord(c) - ord( a ) + 3) % 26 + ord( a )) + strp[i + 1:] else: continue print(strp) 祖国的问候 print("祖国,您好!") print("我来了,学好Python。") 热量转换 I*
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。