author | Nishanth Amuluru <nishanth@fossee.in> |
Tue, 14 Dec 2010 23:15:36 +0530 | |
branch | scipyin2010 |
changeset 456 | a27ccfc118fb |
parent 425 | 5afcfce15e71 |
permissions | -rw-r--r-- |
64
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
cubes = [] |
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
for i in range(10): |
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
cubes.append(i ** 3) |
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
|
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
for i in range(100, 1000): |
425
5afcfce15e71
REF: Reformat some of the exercises so they're easier to read for the audience.
Christopher Burns <chris.d.burns@gmail.com>
parents:
64
diff
changeset
|
6 |
ones = i % 10 |
5afcfce15e71
REF: Reformat some of the exercises so they're easier to read for the audience.
Christopher Burns <chris.d.burns@gmail.com>
parents:
64
diff
changeset
|
7 |
tens = (i / 10) % 10 |
5afcfce15e71
REF: Reformat some of the exercises so they're easier to read for the audience.
Christopher Burns <chris.d.burns@gmail.com>
parents:
64
diff
changeset
|
8 |
hundreds = (i / 100) % 10 |
5afcfce15e71
REF: Reformat some of the exercises so they're easier to read for the audience.
Christopher Burns <chris.d.burns@gmail.com>
parents:
64
diff
changeset
|
9 |
if i == cubes[ones] + cubes[tens] + cubes[hundreds]: |
64
333092b68926
Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
print "Armstrong Number: ", i |