0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

集合

Last updated at Posted at 2019-06-19
my_friends = {'A', 'C', 'D'}
A_friends = {'B', 'D', 'E', 'F'}

print(my_friends & A_friends)
print(my_friends | A_friends)
print(my_friends ^ A_friends)

my_friends & A_friends
で my_friends 且つ A_friends
a且つb.jpg
my_friends | A_friends
で my_friends または A_friends
aまたはb.jpg
my_friends ^ A_friends
で排他
排他.jpg

fruits = ['apple', 'banana']
fruits.append('apple')
fruits.append('orange')
fruits.append('banana')
kind = set(fruits)

print(fruits)
print(kind)

果物リストにappleとbananaがあり、
apple、orange、bananaを買い足した。
リストにある果物の種類を重複なしのユニークでkindに格納
fruitsリストとkindを出力

0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?