Can anyone help me get a more clear understanding for what it is exactly that the assignment is asking me to do?? For example, what exactly is supposed to be in the first function, am i doing the testing in the first function or the generator? It's not clear to me, and the professor hasn't answered my email yet. The basic premise of the assignment is to generate a Palindrome
Ex. Given the integer 192, which is not a palindrome, we obtain a palindrome by applying the above steps four times: 1. Add 192 and its reverse, 291, to get 483. 2. Add 483 and its reverse, 384, to get 867. 3. Add 867 and its reverse, 768, to get 1635. 4. Add 1635 and its reverse, 5361, to get 6996, which is a palindrome!
Write a program, containing the following three functions, to generate palindromes using the above procedure. The str and int built-in functions, which convert back and forth between integers and strings, will come in handy when implementing these functions. [B]1[/B] • A function called palindrome that has a single parameter N (a positive integer) and returns True if N is a palindrome and False otherwise. [B]2[/B] • A function called reverse int that has a single parameter N (a positive integer) and returns its reverse. [B]3[/B] • A function called palindrome generator without any parameters which reads in a pos- itive integer from the user and informs him if the integer is a palindrome or not. If it is not, apply the procedure described above to obtain a palindrome. This should be done by making appropriate calls to the functions palindrome and reverse int. The function should print out every intermediate integer generated by the procedure until the final palindrome. It should also state the number of iterations that were required to go from the original integer to the palindrome. You should allow the user to repeatedly enter integers. See the sample runs for some examples.
Edited 4 Years Ago by arson09: n/a