Skip to content

Instantly share code, notes, and snippets.

/ketaochi1.py Secret

Created April 15, 2016 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/135673587c0206fa6a065d197073123d to your computer and use it in GitHub Desktop.
Save anonymous/135673587c0206fa6a065d197073123d to your computer and use it in GitHub Desktop.
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