Answer to Question #265023 in Python for Raj

Question #265023

Reverse a string and calculate unchanged positions to the original string?


1
Expert's answer
2021-11-12T17:33:38-0500
str1=input("Enter a string: ")


str2=str1[::-1]


print(str1,str2)


count=0
for i in range(len(str1)):
    if(str1[i]==str2[i]):
        count+=1


print("Number of unchanged positions to the original string = ",count)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS