Write a program in Python containing your 'main' and one or more functions you may need that
Question:
Write a program in Python containing your 'main' and one or more functions you may need that will:
A. Read a sequence of integers up from std input such that:
1. Input will only consist of integers.
2.Valid integers to be read into the program will be between 0 and 99999 only. Otherwise discard them.
3.The integers may be white-space separated on the same line or on multiple lines.
4.The end of the sequence will be denoted by -1.
5.The maximum number of integers that should be read into the program will be 8.
6.The input should be read into a basic integer array.
B. Check if each number in the array is a palindrome, i.e. the number is the same if reversed.
IMPORTANT: You are not allowed to use any string methods or convert the numbers to text or treat them as characters in any way when trying to check for palindrome.
C. Print all the palindrome integers (without any duplicates) in descending order separated by spaces on a single line output.
D. Use your main for only getting input, invoking other functions and printing output.
E. Do not use Vectors, Collections, or any other data structures provided by the language platform or any oft-used third party libraries like STL. Do not use strings except to get input if at all. If you do, you can expect major deductions. However, you are allowed to use your own code from the programming labs if you like.
F. Execute your program with the following first two samples - 2 runs.
G. Then, run it a third time with the input of the third sample for which no output has been shown.
H. Take ONE single screenshot showing the output of all 3 runs - your program will not output or prompt anything other than shown in sample.
I. Your program will be tested with my own input.
Sample Inputs | Sample Outputs |
33 101 9876 -1 11111 | 101 33 |
-33 2332 47874 11111 573 88 2345 919 9898 -1 | 47874 11111 2332 919 88 |
57 99999 3434 -343 -888 2332 47874 1111 573 88 2345 919 9898 22222 -1 |
Computer Architecture Fundamentals And Principles Of Computer Design
ISBN: 9781032097336
2nd Edition
Authors: Joseph D. Dumas II