摘要: for i in range(1,10): for j in range(1,10): print('{}x{}={}'.format(i,j,i*j)) 阅读全文
posted @ 2017-04-17 16:07 云ime 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1.for 循环 阅读全文
posted @ 2017-04-17 15:31 云ime 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1.条件判断 即:如果条件成立,就......;反之,就....... 当if后的表达式过长时,可以采取给变量赋值的办法 password_correct = password == '12345' if password_correct: #此时password_correct的值为1/0 #判断 阅读全文
posted @ 2017-04-17 11:55 云ime 阅读(871) 评论(0) 推荐(0) 编辑
摘要: 1.使用函数bool()进行判别 bool(0) bool([]) bool('') bool(False) bool(None) 2.任何对象都可以判断其布尔值 3.除了0、None、False和所有空的序列与集合的布尔值为False之外,其他的都为True 阅读全文
posted @ 2017-04-17 11:31 云ime 阅读(578) 评论(0) 推荐(0) 编辑
摘要: 1.创建一个列表 album = ['black','David Bowie','25','True'] 2.当列表创建完成,使用append向列表添加新元素 album.append('new song') 3.列表的索引 print(album[0],album[-1]) #-1代表album的 阅读全文
posted @ 2017-04-17 11:27 云ime 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 1.成员运算符:in/not in a in b 测试a是否存在于b中 2.身份运算符: is/is not 3.布尔运算符:and/or/not 阅读全文
posted @ 2017-04-17 11:22 云ime 阅读(148) 评论(0) 推荐(0) 编辑
摘要: def function (arg1,arg2): \\定义函数 return 'something' def add(a,b): print(a+b) add(1,2) def add(a,b): return (a+b) print(add(1,2)) a,b是形参,它只是一个形式,表示占据一个 阅读全文
posted @ 2017-04-17 11:08 云ime 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1.编程python学习了三个函数 ①find(str,pos_start,pos_end) 解释: str:被查找“字串” pos_start:查找的首字母位置(从0开始计数。默认:0) pos_end: 查找的末尾位置(默认-1) 返回值:如果查到:返回查找的第一个出现的位置。否则,返回-1。 阅读全文
posted @ 2017-04-17 11:05 云ime 阅读(534) 评论(0) 推荐(0) 编辑