Age Palindromes


15 points

If a mother is 27 years old when her child is born, 14 years later she'll be 41 and her child will be 14. These two ages are palindromes. This program looks at when a mother's age and her child's age are palindromes. For a given age difference between mother and child, the program figures out if there will be any years when their ages will be palindromic. If there are such ages, the program can print them out and count them.



The video below shows a completed program being run.


Starting Point

Download as a starting point for the project. The file guides you towards completing the program.


Extra Credit

3 points

For extra credit, write the function comparePalindromes(). This function considers every mother/child age difference from 18 to 49 years, and prints out how many palindromes exist for that age difference.

The screenshot below shows part of the output from comparePalindromes().


The idea for this program came from Python Programming: An Introduction to Computer Science, Second Edition by John Zelle.