some math scripts

This commit is contained in:
Mari Wahl 2014-10-27 20:10:17 -04:00
parent 9dc0d638a4
commit ab54dc8e70
4 changed files with 151 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#!/usr/bin/python
def finding_gcd(a, b):
''' implements the greatest common divider algorithm '''
while(b != 0):
result = b
a, b = b, a % b
return result
def test_finding_gcd():
number1 = 21
number2 = 12
assert(finding_gcd(number1, number2) == 3)
print('Tests passed!')
if __name__ == '__main__':
test_finding_gcd()