Question: Write a program that asks the user to enter a positive integer and creates and displays a new integer. The program displays also the calculation


Write a program that asks the user to enter a positive integer and creates and displays a new integer. The program displays also the calculation of the process how the new integer was created. Rules of the new integer creation: If the entered integer is a one digit integer, the created integer is the square of the entered integer Example: If the user enters the integer 5 the displayed integer is 25. If the entered integer has an even number of digits, the created integer is the sum of following two integers: the first integer is the integer represented by the first half of digits of the entered integer and the second integer is represented by the second half of digits of the entered integer. Example: If the user enters the integer 5312 the displayed integer is 65 because 53 + 12 = 65. If the entered integer has an odd number of digits (but not one digit), the created integer is the sum of following three integers: the first integer is the integer represented by the first half of digits of the entered integer before the middle integer, the second integer is represented by the middle integer of the entered integer, and the third integer is represented by the second half of digits of the entered integer after the middle integer. Example: If the user enters the integer 53712 the displayed integer is 72 because 53 + 7 + 12 = 72. Note: Consider only good inputs from the user, which are positive integers. Program should be in Python
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
