diff --git a/15.py b/15.py index 399955c..0b424af 100755 --- a/15.py +++ b/15.py @@ -1,13 +1,15 @@ -import sys; - -def factorial(num): - result = 1; - for x in range (num,1,-1): - result *= x; - return result; - -def binomial(m,n): - return factorial(m)/(factorial(n)*factorial(m-n)); - -dimension = int(sys.argv[1]); -print "Result is: " + str(binomial(dimension*2,dimension)); +#!/usr/bin/python + +import sys; + +def factorial(num): + result = 1; + for x in range (num,1,-1): + result *= x; + return result; + +def binomial(m,n): + return factorial(m)/(factorial(n)*factorial(m-n)); + +dimension = int(sys.argv[1]); +print "Result is: " + str(binomial(dimension*2,dimension)); diff --git a/16.py b/16.py index 2dbbe74..efb196e 100755 --- a/16.py +++ b/16.py @@ -1,12 +1,14 @@ -import math; -import sys; - -def sumDigits(num): - sum = 0; - for i in range (0,len(num)): - sum += int(num[i]); - - return sum; - - -print "Result is: " + str(sumDigits(str(int(math.pow(int(sys.argv[1]),int(sys.argv[2])))))) +#!/usr/bin/python + +import math; +import sys; + +def sumDigits(num): + sum = 0; + for i in range (0,len(num)): + sum += int(num[i]); + + return sum; + + +print "Result is: " + str(sumDigits(str(int(math.pow(int(sys.argv[1]),int(sys.argv[2])))))) diff --git a/17.py b/17.py index c23dd48..f5a301d 100755 --- a/17.py +++ b/17.py @@ -1,3 +1,5 @@ +#!/usr/bin/python + import sys; def getLetterNum(num):