【问题描述】要求用户输入两个字符集合,求取它们的交集。
【输入形式】以空格分隔的形式分别输入两个字符集合。
【输出形式】一个字符集合。
【样例输入】a b c
a
【样例输出】{‘a’}
【样例说明】
【评分标准】
set1 = input().split()
set2 = input().split()
set1 = set(set1)
set2 = set(set2)
intersection = set1 & set2
print(intersection)
【问题描述】要求用户输入两个字符集合,求取它们的交集。
【输入形式】以空格分隔的形式分别输入两个字符集合。
【输出形式】一个字符集合。
【样例输入】a b c
a
【样例输出】{‘a’}
【样例说明】
【评分标准】
set1 = input().split()
set2 = input().split()
set1 = set(set1)
set2 = set(set2)
intersection = set1 & set2
print(intersection)
您可能感兴趣的与本文相关的镜像
Python3.11
Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本
1万+

被折叠的 条评论
为什么被折叠?