LoginSignup
1
0

More than 3 years have passed since last update.

Python3でリスト配列をソートする方法

Posted at

Pythonでリスト配列を並び替える方法です

num1 = int(input())
#リスト配列を定義する
data1 = []
for i in range(num1):
    num2 = int(input())
    data1.append(num2)

#非破壊配列で配列を並び替える    
data = sorted(data1)

#データを1行ずつ出力する
for i in range(num1):
    print(data[i])
1
0
0

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
1
0