-
-
Save anonymous/135673587c0206fa6a065d197073123d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fabs_sort(numbers_array): | |
return sorted(numbers_array, key=lambda x: abs(x)) | |
A=[] | |
while True: | |
try: | |
A.append(float(input())) | |
except EOFError: | |
break | |
for i in A: | |
print(i) | |
#絶対値ソート | |
fabs_sorted_A=fabs_sort(A) | |
for i in fabs_sorted_A: | |
print(i) | |
print("sum =",sum(fabs_sorted_A)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment