摘要: #! /usr/bin/env python # -*- coding: utf-8 -*- def quick(list): if len(list) < 2: return list tmp = list[0] # 临时变量 可以取随机值 left = [x for x in list[1:] 阅读全文
posted @ 2020-08-12 08:15 Python代 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 原理:拿自己与上面一个比较,如果上面一个比自己小就将自己和上面一个调换位置,依次再与上面一个比较,第一轮结束后最上面那个一定是最大的数 #! /usr/bin/env pythonf # -*- coding: utf-8 -*- def bubble_sort(li): for i in rang 阅读全文
posted @ 2020-08-12 08:14 Python代 阅读(55) 评论(0) 推荐(0) 编辑
摘要: l = list(range(1,101)) def bin_search(data_set,val): low = 0 high = len(data_set) - 1 while low <= high: mid = (low+high)//2 if data_set[mid] == val: 阅读全文
posted @ 2020-08-12 08:13 Python代 阅读(45) 评论(0) 推荐(0) 编辑
摘要: def fun(i): if i == 0: return 0 elif i == 1: return 1 else: return fun(i-2) + fei(i-1) if __name__ == '__main__': for i in range(10): print(fun(i),end 阅读全文
posted @ 2020-08-12 08:12 Python代 阅读(56) 评论(0) 推荐(0) 编辑
摘要: # def bubble_sort(list):# n = len(list)# # 循环遍历,外层循环每循环一次,内层循环循环一遍 确定一个最大值# for i in range(n-1):# # 遍历无序序列,找到当前查询范围中最大的数值# for j in range(n-1-i):# # 判 阅读全文
posted @ 2020-08-07 15:34 Python代 阅读(73) 评论(0) 推荐(0) 编辑
摘要: # class Fei(object):# def __init__(self,n):# self.n = n# self.num1 = 0# self.num2 = 1# self.current = 0## def __iter__(self):# return self## def __nex 阅读全文
posted @ 2020-08-07 15:32 Python代 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 1.页眉2.标题3.目录的生成4.代码块5.数学公式6.插图7.视频8.音频9.修饰与颜文字10.链接11.表格12.有序列表13.无序列表14.单行与多行15.书签 1.页眉 ,代表页眉,必须在第一行 2.标题 3.目录的生成 使用[TOC]生成目录 4.代码块 print('hello worl 阅读全文
posted @ 2020-05-29 09:56 Python代 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 1虚拟环境 虚拟环境就是一个隔离的python环境,不同的项目应该使用不同的虚拟环境(可以使用同一个虚拟环境),虚拟环境之间是隔离的不会导致环境之间的污染 2.虚拟环境管理模块的安装 # 1.windows系统:pip install virtualenvwrapper -win# 2.mac电脑p 阅读全文
posted @ 2020-05-29 09:55 Python代 阅读(44) 评论(0) 推荐(0) 编辑