author | Christopher Burns <chris.d.burns@gmail.com> |
Sun, 27 Jun 2010 22:05:22 -0500 | |
branch | scipy2010 |
changeset 425 | 5afcfce15e71 |
parent 64 | 333092b68926 |
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 |