摘要: 1.在python中使用单引号或者双引号括起来的就是字符串。2. # 使用6个单引号或双引号 使字符串所见即所得3.在python2中,字符串分为两种类型,第一种是str,第二种是unicode,他们都是继承自basestring。4.在python3中,字符串分为两种类型,第一种是bytes,是p 阅读全文
posted @ 2019-07-06 20:47 水果、、 阅读(210) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 for row in range(1,10): for column in range(1,row+1): print("%d*%d=%d " % (column,row,column*row),end = '') print("") 阅读全文
posted @ 2019-07-06 13:57 水果、、 阅读(230) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # greet = 'hello world' # for in 遍历字符串 # for x in greet: # print (x) # ================================================== # greet = 'python papijiang papa mama' # cou... 阅读全文
posted @ 2019-07-06 13:35 水果、、 阅读(281) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # 打印1到10之间的整数,不要把5打印出来 # index = 0 # while index < 10: # index += 1 # if index ==5: # continue #退出此次循环 # print(index) # 打印1-10之间的所有奇数 # index = 0 # while index < 10: # i... 阅读全文
posted @ 2019-07-06 11:14 水果、、 阅读(787) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # break/continue 只能在循环中使用,不能在其它地方使用,while、for循环中可以使用 # num = 1 # while num num: print('太大') else: print ('恭喜您!答对啦') breakss 阅读全文
posted @ 2019-07-06 10:56 水果、、 阅读(368) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # form_future_import print_function //在python2中引入python3中print函数的语法的语句 # 1.总共有9列 # 2.每行中的列数,就是当前的行号 # 3.乘式的第一个数代表得是列,第二个数代表行 row = 1 column = 1 while row <= 9: while column ... 阅读全文
posted @ 2019-07-05 21:11 水果、、 阅读(1895) 评论(0) 推荐(0) 编辑
摘要: # form_future_import print_function //在python2中引入python3中print函数的语法的语句 阅读全文
posted @ 2019-07-05 20:10 水果、、 阅读(556) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # num = 10 # value = int(input('请输入您的值:')) # if value num: # print('太大') # else: # print('恭喜您!答对了啦') # 改成循环的方式############################### # num = 10 # value = int(input(... 阅读全文
posted @ 2019-07-05 18:05 水果、、 阅读(159) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # 现在要从1到10打印数字 # 1. 代码相似度80%以上,print # 2. 不同的地方就是后面需要打印的东西,每次都是加1 # 3. 总共只有10句 # print'1' # ..... #print '10' # num = 1 # print (num) # num += 1 # print(num) # num += 1 # p... 阅读全文
posted @ 2019-07-05 17:11 水果、、 阅读(162) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # print('hello world') age = 18 if age >= 18: print('可以进入网吧') print('警察叔叔不会找你麻烦') else: print('不可以进入网吧') print('如果你偷偷潜入进去了,那么警察叔叔会找你麻烦') print('finished') 阅读全文
posted @ 2019-07-05 16:45 水果、、 阅读(223) 评论(0) 推荐(0) 编辑