1n = input("Enter the word and see if it is palindrome: ") #check palindrome
2if n == n[::-1]:
3 print("This word is palindrome")
4else:
5 print("This word is not palindrome")
1>>> def isPalindrome(s):
2 ''' check if a number is a Palindrome '''
3 s = str(s)
4 return s == s[::-1]
5
6>>> def generate_palindrome(minx,maxx):
7 ''' return a list of Palindrome number in a given range '''
8 tmpList = []
9 for i in range(minx,maxx+1):
10 if isPalindrome(i):
11 tmpList.append(i)
12
13 return tmpList
14
15>>> generate_palindrome(1,120)
16
17[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111]
18
1value = input("Enter a Word: ")
2
3if value == value[::-1] :
4 print(value)
5 print(value[::-1])
6 print("THIS WORD IS A PALINDROME")
7else :
8 print(value)
9 print(value[::-1])
10 print("THIS WORD IS NOT A PALINDROME")
1#A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward.
2#Ex: madam or racecar.
3#CODE BY VENOM
4a=input("Enter you string:\n")
5w=str(a)
6if w==w[::-1]: # w[::-1] it will reverse the given string value.
7 print("Given String is palindrome")
8else:
9 print("Given String is not palindrome")
10#CODE BY VENOM
11#CODE BY VENOM
12
1def palindrome_check(string):
2 string = list(string)
3 tmp = []
4 #remove any spaces
5 for x in range(0, len(string)):
6 if(string[x] != " "):
7 tmp.append(string[x].lower())
8
9
10 #now reverse the string
11 array1 = []
12 i = 0
13 j = len(tmp)-1
14
15 while(i < len(tmp)):
16 array1.append(tmp[j])
17 i += 1
18 j -= 1
19
20 #check if array1 is equal to the string
21 counter = 0
22 for x in range(0, len(tmp)):
23 if(tmp[x] == array1[x]):
24 counter += 1
25
26 #if the counter is equal to the length of the string then the word
27 #is the same
28 if(counter == len(tmp)):
29 return True
30
31 return False