We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a98784d commit 6f49404Copy full SHA for 6f49404
1 file changed
newcodes/answers/q57.py
@@ -0,0 +1,23 @@
1
+#!/usr/bin/env python
2
+# coding=utf-8
3
+
4
+def palindrome(word):
5
+ word_lst = [ i for i in word ]
6
+ word_lst.reverse()
7
+ new_word = "".join(word_lst)
8
+ if word == new_word:
9
+ return True
10
+ else:
11
+ return False
12
13
+if __name__ == "__main__":
14
+ while True:
15
+ word = input("input a word:('q'-exit)")
16
+ if word == "q":
17
+ break
18
19
+ if palindrome(word):
20
+ print("{0} is a palindrome".format(word))
21
22
+ print("The word is not palindrome")
23
0 commit comments