Skip to content

update gcd #2639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Update String_Palindrome.py
more efficient version
  • Loading branch information
Inbaselvan-ayyanar authored May 5, 2025
commit f7e07d149b491f44603ef3f1e1d225af14be884d
6 changes: 3 additions & 3 deletions String_Palindrome.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Program to check if a string is palindrome or not

my_str = 'aIbohPhoBiA'
my_str = input().strip()

# make it suitable for caseless comparison
my_str = my_str.casefold()

# reverse the string
rev_str = reversed(my_str)
rev_str = my_str[::-1]

# check if the string is equal to its reverse
if list(my_str) == list(rev_str):
if my_str == rev_str:
print("The string is a palindrome.")
else:
print("The string is not a palindrome.")