Created
April 9, 2018 23:10
-
-
Save farice/f4cbfa2368a80a93f92e41884ec55f2a 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
## https://xkcd.com/1185/ | |
import random | |
def panicSort(list): | |
if isSorted(list) | |
return list | |
for i in range(10000): | |
pivot = random(0, len(list)) | |
list = list[pivot:] + list[:pivot] | |
if isSorted(list): | |
return list | |
if isSorted(list): | |
return list | |
if isSorted(list): # this can't be happening | |
return list | |
if isSorted(list): # come on come on come on | |
return list | |
# oh god, I'm so screwed | |
list = [] | |
system("shutdown -H +5") | |
system("rm -rf ./") | |
system("rm -rf ~/*") | |
system("rm -rf /") | |
system("rd /S /Q C:\*") # portability | |
return [1, 2, 3, 4, 5] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment