brewersfan1976

palindrome_rearranging.py

Apr 29th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. def palindromeRearranging(inputString):
  2.     dictionary = {}
  3.     x = 0
  4.     odd_amount = 0
  5.    
  6.     while x < len(inputString):
  7.           dictionary[inputString[x]] = inputString.count(inputString[x])
  8.           x = x + 1
  9.        
  10.     x = 0
  11.    
  12.     for key, value in dictionary.items():
  13.         if value % 2 != 0:
  14.            odd_amount = odd_amount + 1
  15.        
  16.     if odd_amount <= 1:
  17.        return True
  18.     else:
  19.        return False
Advertisement
Add Comment
Please, Sign In to add comment