Skip to content

Commit 571702a

Browse files
committed
Adding explanation to cartalk3.py
1 parent 704b3f8 commit 571702a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

code/cartalk3.py

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def num_instances(diff, flag=False):
4747
count = 0
4848
while True:
4949
mother = daughter + diff
50+
51+
# assuming that mother and daughter don't have the same birthday,
52+
# they have two chances per year to have palindromic ages.
5053
if are_reversed(daughter, mother) or are_reversed(daughter, mother+1):
5154
count = count + 1
5255
if flag:

0 commit comments

Comments
 (0)