Given a list, count and print all the palindrome numbers in it.
Input: 10 121 133 155 141 252 Output: 121 141 252 Total palindrome nos. are 3 Input: 111 220 784 565 498 787 363 Output: 111 565 787 363 Total palindrome nos. are 4
1. Access an element from the list.
2. Now, in a temporary variable get its reverse value.
3. Now, compare the list element value by its reverse value, if both are same print the list element and increase the counter c by 1.
4. Carry on this procedure till list becomes empty.
5. Now, print the counter value i.e total number of palindrome numbers in given list.
121 141 252 Total palindrome nos. are 3 111 565 787 363 Total palindrome nos. are 4
- Python | Numbers in a list within a given range
- Python | Largest number possible from list of given numbers
- Python | Multiply all numbers in the list (3 different ways)
- Python | Convert Stream of numbers to list
- Python | Check if list contains consecutive numbers
- Python | Sort list of numbers by sum of their digits
- Python | Create list of numbers with given range
- Python program to print odd numbers in a List
- Python program to print even numbers in a list
- Python program to count Even and Odd numbers in a List
- Python | Extract numbers from list of strings
- Python | Solve given list containing numbers and arithmetic operators
- Python program to print negative numbers in a list
- Python program to print positive numbers in a list
- Python program to find all Strong Numbers in given list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.