3つの文字をsortしたいです。
Python3
1input_line = input().rstrip().split(' ') 2p1 = int(input_line[0]) 3p2 = int(input_line[1]) 4p3 = int(input_line[2]) 5 6def swap(x,y): 7 x,y = y,x 8 9def sort3(x,y,z): 10 if(x > y): 11 print('x > y 1') 12 x,y = y,x 13 #swap(x,y) 14 if(y > z): 15 print('y > z') 16 y, z = z,y 17 #swap(y,z) 18 if(x > y): 19 print('x > y 2') 20 x,y = y,x 21 #swap(x,y) 22 23sort3(p1,p2,p3) 24 25print(p1) 26print(p2) 27print(p3) 28
これでは何も変わりません。どのような修正を行えばよろしいでしょうか。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/03/04 14:26 編集