Question: Python Programming A palindrome is a word that reads the same backwards as it does forwards, for example 'yay' or 'racecar'. Just as words can
Python Programming
A palindrome is a word that reads the same backwards as it does forwards, for example 'yay' or 'racecar'. Just as words can be palindromes, so can numbers, so for example 56765 and 133331 are both palindromes but 12331 is not.
Write a function largest_palindrome_prod(len_1, len_2): that takes two integers len_1 and len_2, and returns the largest palindrome that can be formed by multiplying an integer with len_1 digits and an integer with len_2 digits.
For example:
If len_1 = 1 and len_2 = 1, largest_palindrome_prod(len_1, len_2) should return 9, since the largest palindromic number we can make by multiplying together two 1 digit numbers is 9 (3 times 3 or 1 times 9).
If len_1 = 1 and len_2 = 2, largest_palindrome_prod(len_1, len_2) should return 828, since the largest palindromic number we can make by multiplying together a 1 digit number and a 2 digit number is 828 (9 times 91).
If len_1 = 2 and len_2 = 3, largest_palindrome_prod(len_1, len_2) should return 94149, since the largest palindromic number we can make by multiplying together a 2 digit number and a 3 digit number is 94149 (99 times 951).
Solution Tips
You can assume that len_1 and len_2 are integers between 1 and 4 inclusive.
Your function should return a value of type int.
You should not return (or print) the numbers that produce the palindrome, only the palindrome itself.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
