Question #265023

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


Expert's answer

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!

LATEST TUTORIALS
APPROVED BY CLIENTS