sairate 7df250638d chore: 添加项目基础结构和示例代码
- 创建 .idea 目录和相关配置文件,设置项目结构
- 添加多个课堂成果示例代码,涵盖不同主题和功能
- 创建和配置 .gitignore 文件,忽略特定文件和目录
2025-07-05 09:36:00 +08:00

27 lines
942 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 三人列出各自的好友签到表
pzai = {'马里奥','狗蛋','二丫','冠冠','卡卡'}
xiaoE = {'静静','铁柱','米粒','瞳瞳','嘟嘟'}
boks = {'小奶酪','倩倩','冠冠','卡卡','轩轩'}
# pzai和boks有一些共同的好友请找出这些共同好友防止重复邀请
common = pzai.intersection(boks)
print(common)
# 有一些是独属于pzai、boks的朋友请找出这些朋友
own_p = pzai.difference(boks)
print(own_p)
own_b = boks.difference(pzai)
print(own_b)
# 将所有人的好友都写在一张签到表上,注意不重不漏
set1 = pzai.union(boks)
all_set = set1.union(xiaoE)
print(all_set)
# 舞会的前两天,收到大家的信息,“卡卡”临时有事无法到场,“小叶子”听说活动主动报名想要参加,所以需要对签到表进行调整
all_set.remove('卡卡')
all_set.add('小叶子')
print('————签到表————')
for i in all_set:
print(i)