string1="hello python" reverse=string1[::-1] print("String is :-",string1) print("Reverse of string :-",reverse)
Explain : Step 1: Set a string name- string1="hello python" Step 2: Set another variable in which reverse value store and we transversing string from -1. Step 3: print the value.