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
| def somsri(): | |
| print ("---------------------------------------------") | |
| print ("| / |") | |
| print ("| ,.. / |") | |
| print ("| ,' '; |") | |
| print ("| ,,.__ _,' /'; . |") | |
| print ("| :',' ~~~~ '. '~ |") | |
| print ("| :' ( ) )::, |") | |
| print ("| '. '. .=----=..-~ .;' |") | |
| print ("| ' ;' :: ':. '' |") |
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
| from setuptools import setup | |
| def readme(): | |
| with open('README.md') as f: | |
| return f.read() | |
| setup(name='grandmasomsri', | |
| version='0.1', | |
| description='Grandma Somsri and Grandpa Prayud', | |
| long_description=readme(), |
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
| def quickSort(alist,low,high): | |
| if low < high: | |
| pivot = partition(alist,low,high) | |
| quickSort(alist,low,pivot-1) | |
| quickSort(alist,pivot+1,high) | |
| return alist |
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
| def parentheses(n,start,close,string): | |
| if( n == close): | |
| print (string) | |
| return | |
| else: | |
| if (start > close): | |
| parentheses(n,start,close+1,string+(")")) | |
| if (start < n): | |
| parentheses(n,start+1,close,string+("(")) |
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
| import copy | |
| maze = [[4, 0, 0, 0, 0, 1], | |
| [1, 1, 0, 0, 0, 1], | |
| [0, 0, 0, 1, 0, 0], | |
| [0, 1, 1, 0, 0, 1], | |
| [0, 1, 0, 0, 1, 0], | |
| [0, 1, 0, 0, 0, 3]] | |
| result = [] |
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
| def mergeSort(alist): | |
| if len(alist) == 1: | |
| return alist | |
| if len(alist) > 1: | |
| mid = len(alist)//2 | |
| leftList = alist[:mid] | |
| rightList = alist[mid:] | |
| mergeLeft = mergeSort(leftList) |
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
| def fibo_iter(n): | |
| a, b = 0, 1 | |
| for i in range(n): | |
| a, b = b, a + b | |
| return a |
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
| def fibo_re(n): | |
| if n == 0: | |
| return 0 | |
| elif n == 1: | |
| return 1 | |
| else: | |
| return fibo_re(n-1) + fibo_re(n-2) |
NewerOlder