摘要:
输入基数,打印星号三角 n = eval(input())for i in range(1,n+1,2): print("{0:^{1}}".format('*'*i, n)) 输入基数13,如图 * *** ***** ******* ********* *********** ********* 阅读全文
摘要:
import timescale = 50print("执行开始".center(scale//2,'-'))start = time.perf_counter()for i in range(scale+1): a = '*' * i b = '.' * (scale - i) c = (i/sc 阅读全文
摘要:
1)format的基本用法 不带编号,即"{}" 带数字编号,可调换顺序,即"{1}","{2}" 带关键字,即"{a}","{tom}" 2)format的进阶用法 <(默认)左对齐,> 右对齐,^ 中间对齐 取位数"{:4s}","{:.2f}"等 3)format 数值用法 “b” 二进制,数 阅读全文