摘要: # 集合是无序的 是可变的 不能重复 允许数学运算 分散存储# 创建# collegel = {'哲学','经济学','法学','教育学'}## # {'教育学', '经济学', '法学', '哲学'}# print(collegel)## # set# collegel2 = set(['金融学' 阅读全文
posted @ 2019-07-30 23:29 EricBlog 阅读(404) 评论(0) 推荐(0) 编辑
摘要: # 数据结构 字符串 列表 元组 数字序列# 10-19的整数# r1 = range(10,20)# print(r1)# print(type(r1))## # 19# print(r1[9])## # range(13, 17)# print(r1[3:7])# 增加步长# r2 = rang 阅读全文
posted @ 2019-07-30 22:36 EricBlog 阅读(1654) 评论(0) 推荐(0) 编辑
摘要: # 元组是'不可变'的 list 使用小括号 创建后不允许修改# 创建# t = ('a','b','c',1,2,3)# print(t)# print(type(t))# # 3# print(t[5])# # 3# print(t[-1])# # ('b', 'c', 1)# print(t[ 阅读全文
posted @ 2019-07-30 22:00 EricBlog 阅读(232) 评论(0) 推荐(0) 编辑
摘要: # 字典的创建# dict1 = {}# print(type(dict1))## dict2 = {# 'name':'汪峰',# 'sex':'男',# 'hiredate':'1997-10-20'# }# print(dict2)## dict3 = dict(name = 'eric',a 阅读全文
posted @ 2019-07-30 18:28 EricBlog 阅读(424) 评论(0) 推荐(0) 编辑
摘要: # 列表的创建# list = ['a','b','c','d','c','e','f','c']# print(list)## list1 = []# print(list1)## # 索引 取值# c = list[2]# print(c)# c = list[-4]# print(c)## # 阅读全文
posted @ 2019-07-30 16:58 EricBlog 阅读(180) 评论(0) 推荐(0) 编辑
摘要: # 赋值运算符# a = 1# b = 2# c = 3# d = 4# e = 5# f = 6## a += 1# print(a )# a -= 1# print(a )## c *= 1# print(c)# d //= 1# print(d)## e %= 4 #1# print(e)## 阅读全文
posted @ 2019-07-30 15:37 EricBlog 阅读(145) 评论(0) 推荐(0) 编辑
摘要: # 循环语句# while 循环'''i = 0;while i < 5: print('python is the best language') i += 1# 阶乘计算器i = 1result = 1while i <= 2: result = result * i if i % 5 == 0 阅读全文
posted @ 2019-07-30 14:33 EricBlog 阅读(193) 评论(0) 推荐(0) 编辑
摘要: # 分支语句age = 233if age < 18: print('您还未满18岁,禁止入内')elif age > 18 and age < 60: print("欢迎光临,年龄在18-60之间")else: print("欢迎光临,年龄大于60岁")weight = input('体重(kg) 阅读全文
posted @ 2019-07-30 13:28 EricBlog 阅读(380) 评论(0) 推荐(0) 编辑
摘要: # 字符串常用函数# 转大写print('bmw'.upper()) # BMW# 转小写print('BMW'.lower()) # bmw# 首字母大写print('how aae you ?'.capitalize()) # How aae you ?# 设置每个单次首字母大写print('m 阅读全文
posted @ 2019-07-30 10:55 EricBlog 阅读(871) 评论(0) 推荐(0) 编辑