Professional Documents
Culture Documents
To write a program which checks whether the given string is palindrome or not.
Python version used
Python 3.9 64 bits
Source Code Name
Program 1.py
Function Used
• Built in function
1.casefold()
2.print()
3.input()
4.list()
Algorithm
1.start
2.define a variable
3.enter the value of variable
4.variable is converted into lower case
5.variable is reversed and compared to original variable
6.print the result
7.end
Input
my_str=input("please enter a string ")
my_str=my_str.casefold()
rev_str=reversed(my_str)
if list (my_str)==list(rev_str):
print("the string is a palindrome")
else:
print("the string is not a palindrome")
Output
Please enter a string: aarya
The string is not a Palindrome.
Size of program
220 bytes