07 2021 档案

摘要:#___author:#date: 2021/6/19'''''#@property 装饰器#测试@property的简化的使用class Employee: @property def dowe(self): print("努力上班") return 10000e = Employee()#e.d 阅读全文
posted @ 2021-07-28 09:27 幻奇 阅读(46) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/16'''''#面向过程和面向对象的区别#面向过程思维:适合编写小规模的程序#面向对象思维:适合编写大规模的程序#面相对象和面向过程的总结#1.都是解决问题的思维方式,都是代码组织的方式#2.解决简单问题可以使用面向过程#3.解决复杂问题:宏观上使 阅读全文
posted @ 2021-07-28 09:26 幻奇 阅读(43) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/5/30#图形模块# import turtle## t = turtle.Pen()# for x in range(360):# t.forward(x)# t.left(90)import turtle# turtle.showturtle() 阅读全文
posted @ 2021-07-28 09:25 幻奇 阅读(44) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/15'''''#lambda 表达式的使用 匿名函数f = lambda a,b,c:a+b+cprint(f) print(f(2,3,4))d = [lambda a:a*2,lambda b:b*3, lambda c:c*4]print(d 阅读全文
posted @ 2021-07-28 09:24 幻奇 阅读(60) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/11#画圆import turtlet = turtle.Pen()my_colos='red','green','yellow','black't.width(4)t.speed(0)for i in range(1000): t.penup() 阅读全文
posted @ 2021-07-28 09:23 幻奇 阅读(68) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/12'''''python函数的分类#python中函数分为如下几类:1.内置函数像str() list() len()等这些是内置函数,不用调用可以直接使用2.标准库函数通过import语句导入的库,然后使用其中定义的函数3.第第三方库函数pyt 阅读全文
posted @ 2021-07-28 09:22 幻奇 阅读(101) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/10#循环代码优化测试import times = time.time()for i in range(1000): b=[] for m in range(10000): b.append(i*1000+m*100)d = time.time() 阅读全文
posted @ 2021-07-28 09:18 幻奇 阅读(43) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/10#列表推导式#列表的语法[表达式 for tine in 可迭代对象]或者[表达式 for time in 可迭代对象 if 条件判断]# a = [x for x in range(1,10)]# print(a)# b = [x*2 for 阅读全文
posted @ 2021-07-28 09:18 幻奇 阅读(110) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/10#iterator()d迭代器#generator()生成器函数a = (10,2,3,0,50,50,6,4,70)for x in a: print(x,end="\t")a = {'name':'小王','age':225,'job':' 阅读全文
posted @ 2021-07-28 09:17 幻奇 阅读(48) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/9#while #循环# a = 0# while a <=100:# print(a,end="\t")# a +=2b = 0c = 0while b<=100: c = c + b b+=1print(c) 阅读全文
posted @ 2021-07-28 09:16 幻奇 阅读(29) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/8#集合创建和删除 集合是不可重复的a = {10,20,30,40,50}a.add(60) #添加print(a)#将列表,元组等可迭代的对象转成集合a = [10,20,30,40,50,50,60]b = set(a) #将列表转化成集合p 阅读全文
posted @ 2021-07-28 09:15 幻奇 阅读(42) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/9# a = input("请输入")# if int(a) >= 10:# print(a)# else:# print(True)# b = input("请输入")# print(b if int(b)>=10 else "数字太大" ) # 阅读全文
posted @ 2021-07-28 09:15 幻奇 阅读(78) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/5#字典的创建a = {'name':'小王','age':225,'job':'programmer'} #创建字典b = dict(name='小王',age=21,job='programmer') #dict创建字典c = dict([(' 阅读全文
posted @ 2021-07-28 09:14 幻奇 阅读(43) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/3#基本语法[]创建列表a = [10,20,7,15,50,15,80,1000] #创建一个空列表#用list()创建列表b = list() #创建一个空列表c = list(range(100))print(c)d = list("admi 阅读全文
posted @ 2021-07-28 09:13 幻奇 阅读(42) 评论(0) 推荐(0)
摘要:#___author: #date: 2021/6/5#元组tyuplea = (10,20,30,40)b = 10,20,30,40c =tuple([10,20,30,40])print(a,b,c)#建新列表的排序o = sorted(a) #建立新列表默认升序print(o)o1 = so 阅读全文
posted @ 2021-07-28 09:02 幻奇 阅读(50) 评论(0) 推荐(0)