基础知识串讲笔记2022-1-24
作者:互联网
基础知
# coding: utf-8 """ # @Time : 2022/1/9 17:56 # @Author : Gina Gao # @File : # @Software: PyCharm # @Descript: """ # 基础知识串讲 # Python库Faker的使用(1):基础使用方法与函数速查 five_men_fight_bg = {"wangdan", "wangwu", "lisi", "zhangsan"} happy_day = {"高可欣", "李财达", "王六", "lisi"} print(five_men_fight_bg.intersection(happy_day)) # 集合 交集属性 等价 print(five_men_fight_bg & happy_day) # 集合 交集属性 print(five_men_fight_bg.difference(happy_day)) # 判断集合元素中,是否包含集合中的元素,求差集 print(five_men_fight_bg - happy_day) print(five_men_fight_bg.isdisjoint(happy_day)) # 判断两个集合是否有相同元素 # 万得谐对象 ,,属性 和方法 # 真实存在的都是对象 print(five_men_fight_bg.union(happy_day)) # 求并集 ,等价于 print(five_men_fight_bg | happy_day) # 哪些常演员,只参演了一部电影 print(five_men_fight_bg.symmetric_difference(happy_day)) print(five_men_fight_bg ^ happy_day) # shift + 6 # 集合是没有下标 # 集合没有重复值 # 快速去重 套娃 # ctrl+alt+l 快速格式化 a = [1, 3, 4, 4, 4, 33] a = list(set(a)) print(a) # 流程控制结构 # 顺序结构 # 选择结构 分支结构 条件语句 # 循环结构 flag = True for floor in range(1, 6): if flag != True: break if floor == 3: continue # 跳出本次循环 print(f"欢迎来到第{floor}层") for room in range(1, 9): print(f"{floor}0{room}") # continue break if floor == 4 and room == 4: print(888) flag = False break # 跳出最近一次循环
识串讲
标签:24,bg,串讲,men,fight,five,2022,print,day 来源: https://www.cnblogs.com/gina11/p/15844706.html