day1/exercise/x.py
author Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Sat, 19 Jun 2010 01:27:20 -0400
branchscipy2010
changeset 409 4442da6bf693
parent 355 6af6441034f9
permissions -rw-r--r--
ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and %time.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
355
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
d1 = [2,4,6,8]
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
d0 = [0,2,4,6,8]
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
dq = [0, 4, 6]
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
for a in d1:
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
    th = a * 1000
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
    for b in d0:
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
        hu = b * 100
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
        for c in d0:
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
            te = c * 10
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
            for u in dq:
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
                n = th + hu + te + u
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
                if is_square(n): print n
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
for i in range(46, 94, 2):
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
    n = i * i
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
    if all_even( n ): print n
6af6441034f9 Added some solutions to exercises written during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19