-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_Tutorial_6d.py
More file actions
29 lines (19 loc) · 856 Bytes
/
Python_Tutorial_6d.py
File metadata and controls
29 lines (19 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# define is_palindrome func that take one word in string as input
# and return True if it is palindrome else return False
# palindrome - word that reads same backwards as forwards
#ex ----> is_palindrome("madam") -----> True
# is_palindrome("horse") -----> False
word_1 = input("Enter the word: ")
word_2 = word_1[::-1]
def is_palindrome(word_1,word_2):
if (word_1 == word_2):
print(f"{word_1} is a palindrome word")
else:
print(f"{word_1} is not a palindrome word")
is_palindrome(word_1,word_2)
##def is_palindrome(word_1): #SHORTCUT
## if (word_1 == word_1[::-1]): # taking input in func call
## print(f"{word_1} is a palindrome word")
## else:
## print(f"{word_1} is not a palindrome word")
##is_palindrome(input("Enter the word: "))