03 2021 档案

摘要:for h in range(1,10):内循环乘以外循环如果不会推算,最好先推算出内循环 for j in range(1,h+1): print("%d*%d=%-2d"%(j,h,j*h),end="") print() 先分析出三的乘法print("%d*%d=%d"%(3 , 1 , 3 阅读全文
posted @ 2021-03-13 11:45 火烧火燎 阅读(41) 评论(0) 推荐(0)
摘要:a=5 b=0 while b<a:横着是行数 外循环,循环行数 i=0 while i<=b:竖着 print("*", end="") i+=1 b+=1 print()换行 阅读全文
posted @ 2021-03-12 22:07 火烧火燎 阅读(201) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-03-09 16:29 火烧火燎 阅读(10) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-03-09 16:28 火烧火燎 阅读(20) 评论(0) 推荐(0)
摘要:a={'qwe':123,'rty':456,'uio':789}字典第一种方式创建 s=dict(zxc=123,vbn=456)字典的第二种方式创建 变量名=doct( ) d={} 创建一个空字典 print(a)打印字典a print(s)打印字典s print(d)打印字典d print( 阅读全文
posted @ 2021-03-09 16:20 火烧火燎 阅读(61) 评论(0) 推荐(0)
摘要:a=[10,20,30,] print(a ,id(a))未进行操作,变量a的ID a.append(50)给变量a加元素 之后 变量a的ID b='123','456' a.extend(b)把变量b加入变量a,此处是,给变量a加入元素的命令.exteng() print(b) a.insert( 阅读全文
posted @ 2021-03-08 15:18 火烧火燎 阅读(53) 评论(0) 推荐(0)
摘要:a=['huui',6788,'iiiyg',788]列表的第一个创建方法 b=list(['hui',68888,'hhhhu'])列表的第二次创建方 print(a,b)打印出列表 print(a[0])序号找到列表元素 print(b.index('hui'))列表元素找到序号 print(a 阅读全文
posted @ 2021-03-07 15:21 火烧火燎 阅读(209) 评论(1) 推荐(1)
摘要: 阅读全文
posted @ 2021-03-05 22:22 火烧火燎 阅读(20) 评论(0) 推荐(0)
摘要:a=[12,25,'we','gg'] print(a[0]) b=[] b.append('fy') print(b) q=list() q=list(range(10)) print(q) s=list() s=list('sffg,tyy') print(s) 阅读全文
posted @ 2021-03-05 22:20 火烧火燎 阅读(57) 评论(0) 推荐(0)
摘要:a="mingzi:{0},daxiao{1}" print(a.format("wo",33)) b="mingzi:{0},cuenkuai:{1:.0f}" print(b.format("wo",12338.2348)) 阅读全文
posted @ 2021-03-05 14:53 火烧火燎 阅读(157) 评论(0) 推荐(0)
摘要:a='*q*w*e*' print(a.strip('*'))去除首尾 * print(a.lstrip('*'))去除左边 * print(a.rstrip('*'))去除右边 * 阅读全文
posted @ 2021-03-04 11:27 火烧火燎 阅读(46) 评论(0) 推荐(0)
摘要:这这个东西以后肯定会经常用的 ,先保存 ,用的多了就会了 阅读全文
posted @ 2021-03-04 10:54 火烧火燎 阅读(65) 评论(0) 推荐(0)
摘要:is 比较字符串儿 是否一样 使用格式 (变量 )is(变量 ) id 查询变量的地址 使用格式 id(变量 ) in 查询字符串中是否有某一个字符 使用格式 ('字符串儿' )in变量 阅读全文
posted @ 2021-03-04 10:42 火烧火燎 阅读(68) 评论(0) 推荐(0)
摘要:import time 导入时间模块 time01 = time.time()起始时间 a=('') for i in range(10000000): a += "qwe" time02 = time.time()结束时间 print("shijin"+str(time02-time01))str 阅读全文
posted @ 2021-03-03 16:49 火烧火燎 阅读(146) 评论(0) 推荐(0)
摘要:a=('qw e e ff fc ') print(a.split('f'))括弧 里边儿有东西 ,测以括号里边儿的东西为字符分号 print(a.split())括弧里边儿没有东西 ,此以逗号为 不分号 print(a[: -3]) a=('ww','ryy','tyu','hjjj') prin 阅读全文
posted @ 2021-03-03 14:42 火烧火燎 阅读(88) 评论(0) 推荐(0)
摘要:a ='qwerty' a=a.replace('w','*')replace——实现了w和*的转换 print(a)打印出来的是这个'q*erty' 阅读全文
posted @ 2021-03-02 19:37 火烧火燎 阅读(37) 评论(0) 推荐(0)
摘要:1 sw=int(input('suiweishuo:')) 2 gw = sw%10个位数 3 sw =sw%100//10十位数 4 bw =sw//100%10百位数 5 qw =sw//1000千位数 6 print()四位数相加 ,怎样让四位数相加自己想办法 阅读全文
posted @ 2021-03-02 16:34 火烧火燎 阅读(366) 评论(0) 推荐(0)
摘要:xm=input("xm:") nl=input("nl:") xb=input("xb:") sg=input("sg:") grxx=f''' ~~~~~~我的个人信息~~~~~~ 姓名 :{xm} 年龄 :{nl} 性别 :{xb} 身高 :{sg} ~~~~~~结束~~~~~~ ''' pr 阅读全文
posted @ 2021-03-02 12:19 火烧火燎 阅读(218) 评论(0) 推荐(0)
摘要:cs = 0 while cs <=10: cs += 1 print(f"{cs}") 阅读全文
posted @ 2021-03-02 12:18 火烧火燎 阅读(44) 评论(0) 推荐(0)
摘要:for i in range(9): print(i) #exit 结束程序 阅读全文
posted @ 2021-03-02 12:16 火烧火燎 阅读(29) 评论(0) 推荐(0)
摘要:这里是随机猜大小 import random sz=random.randint(1 ,100) for i in range(5): sr=int(input("shu_ru:")) if sz< sr: print("大了") elif sz>sr: print("小了") else: exit 阅读全文
posted @ 2021-03-02 12:14 火烧火燎 阅读(64) 评论(0) 推荐(0)
摘要:for i in range (10): if i<= 5: print(i * "*") else: print((10-i) * "*") 阅读全文
posted @ 2021-03-02 12:13 火烧火燎 阅读(30) 评论(0) 推荐(0)
摘要:for i in range(1,19): print(f" {i}层 ") if i==4: continue for j in range(1,7): if i==5 and j==5: print("beibei") break print(f"l{i}--{i}--{j}室") View C 阅读全文
posted @ 2021-03-02 12:12 火烧火燎 阅读(17) 评论(0) 推荐(0)