Write a Python program that takes a positive integer from the user and prints the number of digits of that number. If the number of digits is odd, print the value of the middle digit of the number. If...


Write a Python program that takes a positive integer from the user and prints the number of digits of<br>that number.<br>If the number of digits is odd, print the value of the middle digit of the number. If the number of<br>digits is even,<br>Divide the number in half and print the number values of its first and last halves.<br>Entry:<br>Integer: 2<br>Output:<br>Number of digits: 1<br>middle digit: 2<br>Entry:<br>Integer: 5432<br>Output:<br>Number of digits: 4<br>First half: 54<br>Last half: 32<br>Entry:<br>Integer: 1611642<br>Output:<br>Number of digits: 7<br>middle digit: 1<br>Entry:<br>Integer: 7000000582<br>Output:<br>Number of digits: 10<br>First half: 7000<br>Last half: 582<br>

Extracted text: Write a Python program that takes a positive integer from the user and prints the number of digits of that number. If the number of digits is odd, print the value of the middle digit of the number. If the number of digits is even, Divide the number in half and print the number values of its first and last halves. Entry: Integer: 2 Output: Number of digits: 1 middle digit: 2 Entry: Integer: 5432 Output: Number of digits: 4 First half: 54 Last half: 32 Entry: Integer: 1611642 Output: Number of digits: 7 middle digit: 1 Entry: Integer: 7000000582 Output: Number of digits: 10 First half: 7000 Last half: 582

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here