Skip to content

Instantly share code, notes, and snippets.

@Code-Hex
Last active August 29, 2015 14:09
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 Code-Hex/a8449e3e3737ead9ec9c to your computer and use it in GitHub Desktop.
Save Code-Hex/a8449e3e3737ead9ec9c to your computer and use it in GitHub Desktop.
pythonでソート
#!/usr/bin/python
# coding: UTF-8
import random
a = range(10)
for i in range(10):
a[i] = random.randint(0,10)
print "a"
print a # random array
print ""
print "sorted(a)"
print sorted(a) # 一時的なソート
print ""
print "a"
print a
print ""
a.sort() # 永久的なソート
print "a.sort()"
print a
@Code-Hex
Copy link
Author

sorted() と .sort() の違い

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment