Question: 3. Write a Python program stored in a file L4q3.py that: . Gets single-digit numbers from the user on one line (digits are separated by

3. Write a Python program stored in a file L4q3.py that: . Gets single-digit numbers from the user on one line (digits are separated by white space) and adds them to a list. The first digit and the last digit should not be a zero. If the user provides an invalid entry, the program should prompt for a new value. Converts every entry in the list to an integer and prints the list. The digits in the list represent a non- negative integer. For example, if the list is [4,5,9,1], the entries represent the integer 4591. The most significant digit is at the zeroth index of the list. Adds the integer that the reversed value of the integer. For example, if the list is [4,5,9,1], the addition will be 4591 + 1954 = 6545 and the resulting list will be [6,5,4,5) ******** Sample Output#1: 1. **************************************** 2. Enter single digits separated by one space: 0 5 1 1 3. Invalid list, try again. 4. 5. Enter single digits separated by one space: 8 5 9 0 6. Invalid list, try again. 7. 8. Enter single digits separated by one space: 0 58 1 14 9. Invalid list, try again. 10. 11. Enter single digits separated by one space: 4 5 9 1 12. The initial list is: [4,5,9,1] 13. The reversed list is: [1,9,5,4] 14. The addition list is: [6,5,4,5) 15. ************************ ************** Sample Output#2: 1. ************************************************** 2. Enter single digits separated by one space : 9 9 9 9 2 3. The initial list is: [9,999,9,2] 4. The reversed list is: [2,9,9,9,9] 5. The addition list is: [1,2,9,9,9,1] 6. ************ ********
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
