0% found this document useful (0 votes)
3 views5 pages

DSA Engineering Animuthyam Python 4

The document discusses a Python DSA course focused on reversing strings and identifying palindromes. It provides examples and code snippets for reversing words and checking if a word is a palindrome. Additionally, it includes links to the course and website for further learning.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

DSA Engineering Animuthyam Python 4

The document discusses a Python DSA course focused on reversing strings and identifying palindromes. It provides examples and code snippets for reversing words and checking if a word is a palindrome. Additionally, it includes links to the course and website for further learning.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Engineering Animuthyam

Python DSA – Course Part -4


Course Link:
[Link]
wP

Website Link:
[Link]

Hello machas, Bagunnara.

Animuthyam ki oka problem ochindhi

Athaniki godamidha koni words icharu, vatini reverse


chesthe, oko word ki 1 lakh ruppes isthar anta.

So mana animuthyam rich kadaniki manam help chedham.


Sample:
DSA -> ASD
bangaram -> maragnab
chapri -> irpahc

s = "bangaram"
ans=""
for i in range(len(s)-1,-1,-1):
ans = ans +s[i]

print(ans)

Animuthyam ki oka problem ochindhi

Goda midha malla evaro pullaroa koni words rasaru.


Avi palindrome aa kaadha ani chepali.

Palindrome ante venka nundi mundhu nundi same


vundadam.
Examples of palindromes.

aba = > ( dhini reverse chesna “aba” ne avthundhi )


abba => ( dhini reverse chesna kuda “abba” ne avthundhi )

Sample = >
paap => Yes, it is a palindrome
tuck => No, it is not a palindrome
Bot => no, it is not a palindrome

Syntax you should know:


break ( this can be used to get out of for loop
immediately);
Way-1: reverse a string an compare both.
s = "bangaram"
ans=""
for i in range(len(s)-1,-1,-1):
ans = ans +s[i]
if ans == s:
print("yes,it is a palindrome")
else:
print("No, it is not a palindrome")
Way – 2:
isPalindrome = true
s="aba"
n=[Link]()
mid=n//2;
for i in range(mid):
if(s[i]!=s[ n-i-1]):
isPalindrome = false
break

if(isPalindrome):
print("yes,it is a palindrome")
else:
print("No, it is not a palindrome")

You might also like