Created
April 6, 2018 15:55
-
-
Save au5ton/41d02b1c92a5bae8b02d7e5e4217fdbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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/python3 | |
def fibonacci(n): | |
if(n==0): | |
return 0 | |
else if(n==1): | |
return 1 | |
else: | |
return fibonacci(n-1)+fibonacci(n-2) | |
print(fibonacci(4)) |
This file contains hidden or 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/python3 | |
from random import * | |
from time import * | |
def inorder(x): | |
i = 0 | |
j = len(x) | |
while i + 1 < j: | |
if x[i] > x[i + 1]: | |
return False | |
i += 1 | |
return True | |
def drunk_sort(ilist): | |
while not inorder(ilist): | |
shuffle(ilist) | |
return ilist | |
print(drunk_sort([1, 4, 3])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment