0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

重複の削除 Python3編

Posted at

N 個の要素からなる数列 A が与えられます。数列 A は昇順にソートされています。A の重複した要素を取り除いて昇順に出力してください。

辞書の作り方を前回学んだので
さっそくここでも。

N = int(input())
A = {int(x) for x in input().split()}
print(*sorted(A))

この場合他の作り方もあったので復習で一応やっとく

print(" ".join(map(str, A)))
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?