Skip to content

Commit

Permalink
# Permute a Palindrome
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 17, 2024
1 parent cadec14 commit 84ba365
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions kyu_6/permute_a_palindrome/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Permute a Palindrome."""
6 changes: 4 additions & 2 deletions kyu_6/permute_a_palindrome/permute_a_palindrome.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""
Solution for -> Permute a Palindrome
Solution for -> Permute a Palindrome.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def permute_a_palindrome(string: str) -> bool:
"""
Permute a Palindrome.
A function that check whether the permutation
of an input string is a palindrome.
:param string:
Expand All @@ -20,7 +23,6 @@ def permute_a_palindrome(string: str) -> bool:

non_even: int = 0
chars: set = set(string)

for char in chars:
if string.count(char) % 2 != 0:
non_even += 1
Expand Down
16 changes: 9 additions & 7 deletions kyu_6/permute_a_palindrome/test_permute_a_palindrome.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Test for -> Permute a Palindrome
Test for -> Permute a Palindrome.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
Expand All @@ -24,13 +25,12 @@
url='https://www.codewars.com/kata/58ae6ae22c3aaafc58000079',
name='Source/Kata')
class PermutePalindromeTestCase(unittest.TestCase):
"""
Testing permute_a_palindrome function
"""
"""Testing permute_a_palindrome function."""

def test_permute_a_palindrome_positive(self):
"""
Testing permute_a_palindrome function
Testing permute_a_palindrome function with various test data.
:return:
"""
# pylint: disable-msg=R0801
Expand Down Expand Up @@ -70,7 +70,8 @@ def test_permute_a_palindrome_positive(self):

def test_permute_a_palindrome_negative(self):
"""
Negative testing permute_a_palindrome function
Negative testing permute_a_palindrome function.
:return:
"""
# pylint: disable-msg=R0801
Expand Down Expand Up @@ -104,7 +105,8 @@ def test_permute_a_palindrome_negative(self):

def test_permute_a_palindrome_empty_string(self):
"""
Testing permute_a_palindrome function with empty string
Testing permute_a_palindrome function with empty string.
:return:
"""
# pylint: disable-msg=R0801
Expand Down

0 comments on commit 84ba365

Please sign in to comment.