From c28095d9466e1bde9a8aba06ee045c975f120d6a Mon Sep 17 00:00:00 2001 From: Ashiri Date: Wed, 18 Oct 2017 03:46:01 +0100 Subject: [PATCH] Script to understand slicing --- samplecheckpalindrome.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 samplecheckpalindrome.py diff --git a/samplecheckpalindrome.py b/samplecheckpalindrome.py new file mode 100644 index 0000000..0bbdaed --- /dev/null +++ b/samplecheckpalindrome.py @@ -0,0 +1,16 @@ +def checkPalindrome(word): + ''' + This program checks if a word or sentence is a palindrome. + + A palindrome is a word or statement that reads the same in reverse + :param word: This parameter is a string of words or sentence to be checked. + :return: The function doesn't have a return value. + ''' + if word == word[::-1]: + print('Word is a palindrome') + else: + print('Word is not a palindrome') + + +checkPalindrome('sms') +checkPalindrome('ayak')