Last active
August 29, 2015 14:09
-
-
Save Code-Hex/a8449e3e3737ead9ec9c to your computer and use it in GitHub Desktop.
pythonでソート
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorted() と .sort() の違い