Skip to content

Commit 048ef4d

Browse files
2 parents ab0afe4 + 329a2f2 commit 048ef4d

File tree

1 file changed

+3
-3
lines changed
  • Python/chapter01/1.4 - PalinPerm

1 file changed

+3
-3
lines changed

Python/chapter01/1.4 - PalinPerm/Nick4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ def palperm(string):
1515
string (str): a string to check for all palindrome permutations
1616
'''
1717
table = {}
18-
count = 0
1918
for letter in string.lower().replace(" ", ""):
2019
table[letter] = table.get(letter, 0) + 1
2120

21+
count = 0
2222
for key in table:
23-
if count > 1:
24-
return False
2523
if table[key] % 2 == 1:
2624
count += 1
25+
if count > 1:
26+
return False
2727
return True
2828

2929
def palperm2(string):

0 commit comments

Comments
 (0)