摘要: 今日作业 # 第一题import timeimport randomdef foo(): print('开始执行。。。') time.sleep(random.uniform(1,3)) print('执行完毕') return '都结束了'print(foo())​# 第二题import time 阅读全文
posted @ 2019-11-12 20:41 迎着阳光 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 第十一天 闭包函数 闭包函数是,函数嵌套、函数对象、名称空间和作用域的结合体 # 直接传参# def func(x):# print(x)## func(100)​# 通过闭包函数传参# def foo(num):# num = 100# def coo():# print(num)# return 阅读全文
posted @ 2019-11-12 20:40 迎着阳光 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 第十天 函数对象 函数是第一类对象 函数名是可以被引用的 def foo(): print('hello wanglu')a = fooa() 函数名可以当做参数传递 ​def foo(a, b, doo): print(a, b, doo) doo()​def coo(): print('hell 阅读全文
posted @ 2019-11-11 20:09 迎着阳光 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 第九天 函数 '''1、无参函数:def index(): print('ok')2、空函数:def index(): passdef login(): pass3、有参函数:def login(username): print(udername)''' 返回值: 1、不写return:默认返回No 阅读全文
posted @ 2019-11-09 19:24 迎着阳光 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 张金易第八天作业 '''1、文件a.txt内容:每一行内容分别为商品名字,价钱,个数,求出本次购物花费的总钱数apple 10 3tesla 100000 1mac 3000 2lenovo 30000 3chicken 10 3​'''# with open(r'z.txt','r',encodi 阅读全文
posted @ 2019-11-08 20:15 迎着阳光 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 第八天 文件打开模式的补充 '''除了可读·可写之外剩下都是自己的特性r+w+a+'''with open(r'r.txt','r+',encoding='gbk') as f: f.write('绘梨衣') print(f.read()) # print(f.readable()) # print 阅读全文
posted @ 2019-11-08 20:14 迎着阳光 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 第七天 字符编码 前置知识点: 1、程序执行的三大核心硬件(***): cpu ​ 内存 ​ 硬盘 正常执行一个程序的要点: 1、将硬盘中的数据读到内存 ​ 2、由cpu读内存中的数据进行执行 ​ 3、在执行程序的时候,生成的数据,优先存入内存 2、python解释器执行一个py文件过程(***) 阅读全文
posted @ 2019-11-07 20:15 迎着阳光 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 张金易 第四天作业 # 使用while循环输出1 2 3 4 5 6 8 9 10​# count = 0# while count < 10:# count += 1# if count == 7:# continue# print(count)​''' 1、允许用户最多尝试3次 2、每尝试3次后 阅读全文
posted @ 2019-11-06 20:56 迎着阳光 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 第六天 列表的内置方法 count 统计当前列表内指定元素的个数 l1 = ['jinyi','wanglu','qiaobi','love','jinyi']print(l1.count('jinyi'))# 2 index 获取当前指定元素的索引值,还可以指定查找范围 l1 = ['jinyi' 阅读全文
posted @ 2019-11-06 20:52 迎着阳光 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 第五天 数据类型的内置方法 整型(int) 用途:一般用于定义整数:年龄,QQ号,身份证号 定义方式 age = 18 # age = int(18) 常用方法,数学计算 进制之间的转换 """其他进制转10进制​二进制转十进制:0,1​110 1 * (2**2) + 1 * (2**1) + 0 阅读全文
posted @ 2019-11-06 16:22 迎着阳光 阅读(204) 评论(0) 推荐(0) 编辑