Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

palindrome Rearranging python one line

def palindromeRearranging(inputString):
    return sum(map(lambda x: inputString.count(x) % 2, set(inputString))) <= 1
Comment

palindrome rearranging python

import collections
def palindromeRearranging(inputString):
  cnt = collections.Counter()
  odds = 0
  for i in range(len(inputString)):
    cnt[inputString[i]] += 1
  for i in cnt:
    if cnt[i]%2 == 1:
      odds += 1
  return odds <= 1
Comment

Palindrome in Python Using reverse function

def check_palindrome_1(string):
    reversed_string = string[::-1]
    status=1
    if(string!=reversed_string):
        status=0
    return status


string = input("Enter the string: ")
status= check_palindrome_1(string)
if(status):
    print("It is a palindrome ")
else:
    print("Sorry! Try again")
Comment

PREVIOUS NEXT
Code Example
Python :: get all combinations from two lists python 
Python :: torch save 
Python :: flask migrate install 
Python :: how to insert sound in python 
Python :: select text in a div selenium python 
Python :: convert series to datetime 
Python :: prime number generator python 
Python :: climate change 
Python :: pyqt5 pylatex 
Python :: pythondatetime cheatsheet 
Python :: static dirs django 
Python :: replace url with text python 
Python :: how to move a column in pandas dataframe 
Python :: django password change view 
Python :: remove after and before space python 
Python :: chi square test in python 
Python :: fill na with mode and mean python 
Python :: lda scikit learn 
Python :: python random choice in list 
Python :: python change cwd to script directory 
Python :: nested dict to df 
Python :: rename columns in dataframe 
Python :: pil image base64 
Python :: python check version 
Python :: or statement django template 
Python :: open python choose encoding 
Python :: how to check if everything inside a list is unique 
Python :: label encode one column pandas 
Python :: how to find index of second largest number in array python 
Python :: python read file txt and return list of each lines 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =