# coding=utf-8
# 什么是set
if __name__ == '__main__':
# set和list类似,拥有一系列元素,set里面的元素是不允许重复的,而list里面可以包含相同的元素
# 而且set里面的元素没有顺序
# 创建set的方式是使用 set(),并传入一个list
s = set([1,4,5,3,2])
print(s)
# 在创建set是,会自动将list中重复的数据去重
s = set([1,4,5,3,2,1,5])
print(s)
结果:
{1, 2, 3, 4, 5}
{1, 2, 3, 4, 5}