← Projects

Check palindrome done

a6a90eddd9db5b646e28bd7c041899e862a7bcf1 · Karan Goel · Jul 12, 2013 13:18

+12 · 1 file changed

  • Text/palindrome.py +12 −0
diff --git a/Text/palindrome.py b/Text/palindrome.py
new file mode 100644
index 0000000..43c7f41
--- /dev/null
+++ b/Text/palindrome.py
@@ -0,0 +1,12 @@
+"""
+Check if Palindrome - Checks if the string entered
+by the user is a palindrome. That is that it reads
+the same forwards as backwards like "racecar"
+"""
+
+string = raw_input('Enter a string: ').lower()
+
+if string == string[::-1]:
+    print '%s is a palindrome' % string
+else:
+    print '%s is not a palindrome' % string