{"id":18505,"date":"2021-08-26T10:38:58","date_gmt":"2021-08-26T05:08:58","guid":{"rendered":"https:\/\/python-programs.com\/?p=18505"},"modified":"2021-11-22T18:37:17","modified_gmt":"2021-11-22T13:07:17","slug":"python-program-to-count-the-number-of-odd-and-even-digits","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-count-the-number-of-odd-and-even-digits\/","title":{"rendered":"Python Program to Count the Number of Odd and Even Digits"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Replace a Word with Asterisks in a Sentence<\/a>
\nGiven a number and the task is to count the number of odd and even digits in a given number.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 1237891<\/pre>\n

Output:<\/strong><\/p>\n

The count of even digits in a given number{ 1237891 } = 2\r\nThe count of odd digits in a given number{ 1237891 } = 5<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 78342186453<\/pre>\n

Output:<\/strong><\/p>\n

The count of even digits in a given number{ 78342186453 } = 6\r\nThe count of odd digits in a given number{ 78342186453 } = 5<\/pre>\n

Program to Count the Number of Odd and Even Digits in Python<\/h2>\n

Below are the ways to count the number of odd and even digits in a given number :<\/p>\n