Skip to content

Commit 9aea1cc

Browse files
committed
Minor changes in the file
1 parent b291d90 commit 9aea1cc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

palindrome/palindrome.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
def remove_special_char(string):
22
''' Removes all special characters from a string '''
3-
forbidden = (".", ",", "!", ";", ":", "-", "_", "?", "/")
3+
forbidden_char = (".", ",", "!", ";", ":", "-", "_", "?", "/")
44
new_string = ""
55
for s in string:
6-
if s not in forbidden:
6+
if s not in forbidden_char:
77
new_string += s
88
return new_string
99

@@ -19,12 +19,12 @@ def palindrome_test(word):
1919

2020

2121
def main():
22-
is_palindrome = \
23-
palindrome_test(input("Type a word to test if it is palindrome: "))
22+
word = input("Type a word to test if it is palindrome: ")
23+
is_palindrome = palindrome_test(word)
2424
if is_palindrome:
25-
print("The word typed is palindrome")
25+
print(f"The word {word} is palindrome")
2626
else:
27-
print("The word typed isn't palindrome")
27+
print(f"The word {word} isn't palindrome")
2828

2929

3030
if __name__ == '__main__':

0 commit comments

Comments
 (0)