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 :: python import multiple csv 
Python :: Get last “column” after .str.split() operation on column in pandas DataFrame 
Python :: python script header 
Python :: how to check if email exists in python 
Python :: remove outliers python dataframe 
Python :: python - row slice dataframe by number of rows 
Python :: 1 line if statement python 
Python :: remove special characters from string python 
Python :: django iterate over all objects 
Python :: pandas read csv 
Python :: python list comprehension with if 
Python :: how to pick out separate columns from the pandas dataframe object 
Python :: prevent list index out of range python 
Python :: adding columns in cpecific position 
Python :: convert pdf folder to excell pandas 
Python :: difference between 2 timestamps pandas 
Python :: case statement in querset django 
Python :: python remove nan rows 
Python :: port 5432 failed: timeout expired 
Python :: numpy flatten 
Python :: pandas transpose 
Python :: move file python 
Python :: python cv2 get image shape 
Python :: measure execution time in jupyter notebook 
Python :: convert data type object to string python 
Python :: password generator in python 
Python :: python change terminal name 
Python :: tkinter progressbar set value 
Python :: Python Crash Course, 2nd Edition: A Hands-On, Project-Based Introduction to Programming 
Python :: set form field disabled django 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =