吴裕雄--天生自然 PYTHON3开发学习:集合
fruits = {"apple", "banana", "cherry"}
fruits.add("orange")
print(fruits)
fruits = {"apple", "banana", "cherry"}
fruits.clear()
print(fruits)
fruits = {"apple", "banana", "cherry"}
x = fruits.copy()
print(x)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"} z = x.difference(y) print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"} x.difference_update(y) print(x)
fruits = {"apple", "banana", "cherry"} fruits.discard("banana") print(fruits)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} z = x.intersection(y) print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} x.intersection_update(y) print(x)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "facebook"} z = x.isdisjoint(y) print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} z = x.isdisjoint(y) print(z)
fruits = {"apple", "banana", "cherry"} fruits.pop() print(fruits)
fruits = {"apple", "banana", "cherry"} fruits.remove("banana") print(fruits)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} z = x.symmetric_difference(y) print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} x.symmetric_difference_update(y) print(x)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} z = x.union(y) print(z)
x = {"a", "b", "c"}
y = {"f", "d", "a"}
z = {"c", "d", "e"} result = x.union(y, z) print(result)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} z = x.union(y) print(z)
x = {"a", "b", "c"}
y = {"f", "d", "a"}
z = {"c", "d", "e"} result = x.union(y, z) print(result)
x = {"apple", "banana", "cherry"}
y = {"google", "runoob", "apple"} x.update(y) print(x)
吴裕雄--天生自然 PYTHON3开发学习:集合的更多相关文章
- 吴裕雄--天生自然 PYTHON3开发学习:基本数据类型
#!/usr/bin/python3 counter = 100 # 整型变量 miles = 1000.0 # 浮点型变量 name = "runoob" # 字符串 print ...
- 吴裕雄--天生自然 PYTHON3开发学习:MySQL - mysql-connector 驱动
import mysql.connector mydb = mysql.connector.connect( host="localhost", # 数据库主机地址 user=&q ...
- 吴裕雄--天生自然 PYTHON3开发学习:列表
list1 = ['Google', 'Runoob', 1997, 2000]; list2 = [1, 2, 3, 4, 5 ]; list3 = ["a", "b& ...
- 吴裕雄--天生自然 PYTHON3开发学习:字符串
var1 = 'Hello World!' var2 = "Runoob" #!/usr/bin/python3 var1 = 'Hello World!' var2 = &quo ...
- 吴裕雄--天生自然 PYTHON3开发学习:数字(Number)
print ("abs(-40) : ", abs(-40)) print ("abs(100.10) : ", abs(100.10)) #!/usr/bin ...
- 吴裕雄--天生自然 PYTHON3开发学习:运算符
#!/usr/bin/python3 a = 21 b = 10 c = 0 c = a + b print ("1 - c 的值为:", c) c = a - b print ( ...
- 吴裕雄--天生自然 PYTHON3开发学习:基础语法
#!/usr/bin/python3 # 第一个注释 print ("Hello, Python!") # 第二个注释 #!/usr/bin/python3 # 第一个注释 # 第 ...
- 吴裕雄--天生自然 PYTHON3开发学习:函数
def 函数名(参数列表): 函数体 # 计算面积函数 def area(width, height): return width * height def print_welcome(name): ...
- 吴裕雄--天生自然 PYTHON3开发学习:MongoDB
import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclien ...
随机推荐
- [Mathematics][MIT 18.03] Detailed Explanation of the Frequency Problems in Second-Order Differential Equation of Oscillation System
Well, to begin with, I'd like to say thank you to MIT open courses twice. It's their generosity that ...
- React yarn安装umi后 umi -v查询版本失败
采坑描述:yarn全局安装模块后但仍提示无法找到 解决: 1.先查看一下yarn的bin目录,输入yarn global bin 2.然后将该路径加入到path中,对于windows中直接将该目录加入 ...
- Relu激活函数的优点
Relu优点: 1.可以使网络训练更快. 相比于sigmoid.tanh,导数更加好求,反向传播就是不断的更新参数的过程,因为其导数不复杂形式简单. 2.增加网络的非线性. 本身为非线性函数,加入到神 ...
- 卷积神经网络应用于tensorflow手写数字识别(第三版)
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_dat ...
- Maven:A cycle was detected in the build path of project 'xxx'. The cycle consists of projects {xx}
以下这个错误是在Eclipse中导入多个相互依赖的工程时出现的“循环依赖问题”:A cycle was detected in the build path of project 'xxx'. The ...
- GRUB&MBR引导
(ubuntu下搜索gnome-disk可以打开磁盘管理) 简单开机过程 : ①按下电源后,计算机自检(POST),如果硬件设备(CPU.内存.硬盘.光驱.各种卡)都没有问题,BIOS会检查各个硬盘的 ...
- c语言中%s和%d的区别
/************************************************************************* > File Name: ptr_both. ...
- 洛谷P1002 过河卒(动态规划)
题目描述 棋盘上 AA 点有一个过河卒,需要走到目标 BB 点.卒行走的规则:可以向下.或者向右.同时在棋盘上 CC 点有一个对方的马,该马所在的点和所有跳跃一步可达的点称为对方马的控制点.因此称之为 ...
- HGP|VCG|UK10K|中科院职业人群队列研究计划|药物基因组学
全球性计划:表观组计划:肝计划 测1000人的变异level HGP计划三个阶段,范围逐步扩大和深化. Pilot:deep sequence---low coverage Phase 1 Phase ...
- 用Axure画原型图有感
感觉前端做UE非常有优势啊- 但是在制作的时候,似乎陷入了误区: (1)只求原型图的漂亮,色彩丰富,忽略了其本质作用,是用来整理逻辑,画出逻辑流程的. (2)一开始就追求交互,高保真的原型,忽视了细节 ...