- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Find Numbers with Even Number of Digits in Python

Suppose we have a list of numbers. We have to count the numbers that has even number of digit count. So if the array is like [12,345,2,6,7896], the output will be 2, as 12 and 7896 has even number of digits

To solve this, we will follow these steps −

- Take the list and convert each integer into string
- if the length of string is even, then increase count and finally return the count value

## Example

Let us see the following implementation to get better understanding −

class Solution(object): def findNumbers(self, nums): str_num = map(str, nums) count = 0 for s in str_num: if len(s) % 2 == 0: count += 1 return count ob1 = Solution() print(ob1.findNumbers([12,345,2,6,7897]))

## Input

[12,345,2,6,7897]

## Output

2

- Related Articles
- Fetch Numbers with Even Number of Digits JavaScript
- Find the Number With Even Sum of Digits using C++
- Count Numbers with N digits which consists of even number of 0's in C++
- Find smallest number with given number of digits and sum of digits in C++
- Total number of non-decreasing numbers with n digits
- Find the Largest number with given number of digits and sum of digits in C++
- Number of even substrings in a string of digits in C++
- Find the sum of digits of a number at even and odd places in C++
- Check whether product of digits at even places is divisible by sum of digits at odd place of a numbers in Python
- C++ code to find total number of digits in special numbers
- Program to count number of stepping numbers of n digits in python
- Average of even numbers till a given even number?
- Find number of subarrays with even sum in C++
- C++ code to count number of lucky numbers with k digits
- Check whether product of digits at even places of a number is divisible by K in Python

Advertisements