diff options
author | Puneeth Chaganti | 2010-01-12 19:05:09 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2010-01-12 19:05:09 +0530 |
commit | 75206fd2f3c988fd74f05a43898666cff9e9682b (patch) | |
tree | 86035dfa9287d49ee0d39c3641d9e55b368de454 /day1/exercise/arms.py | |
parent | 1fb43f5dcbc83f1330b72d2629746fe2a257ed2a (diff) | |
download | workshops-more-scipy-75206fd2f3c988fd74f05a43898666cff9e9682b.tar.gz workshops-more-scipy-75206fd2f3c988fd74f05a43898666cff9e9682b.tar.bz2 workshops-more-scipy-75206fd2f3c988fd74f05a43898666cff9e9682b.zip |
Added some solutions to exercises written during REC Chennai workshop.
Diffstat (limited to 'day1/exercise/arms.py')
-rw-r--r-- | day1/exercise/arms.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/day1/exercise/arms.py b/day1/exercise/arms.py new file mode 100644 index 0000000..33196fd --- /dev/null +++ b/day1/exercise/arms.py @@ -0,0 +1,18 @@ +# Armstrong Numbers + +for n in range(100, 1000): +# s = str(n) +# a, b, c = int(s[0]), int(s[1]), int(s[2]) +# if a * a * a + b * b * b + c * c * c == n: +# print n +# sum, copy = 0, n +# while copy > 0: +# sum += (copy % 10) ** 3 +# copy /= 10 +# if sum == n: +# print n + u = n % 10 + h = n / 100 + t = (n/10) % 10 + if h ** 3 + t ** 3 + u ** 3 == N: + print n |