author | Madhusudan.C.S <madhusudancs@gmail.com> |
Wed, 28 Oct 2009 20:32:06 +0530 | |
changeset 249 | 135062d6f91f |
parent 94 | 8c92864c184b |
child 380 | 669b72283b55 |
permissions | -rw-r--r-- |
94
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
def all_digits_even(n): |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
if n < 0: n = -n |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
while n > 0: |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
if n % 2 == 1: |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
return False |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
n /= 10 |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
return True |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
|
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
i = 46 |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
while i <= 94: |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
square = i * i |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
if all_digits_even(square): |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
print square |
8c92864c184b
Almost last set of official solutions and final quiz.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
i += 1 |