Reverse the String in python

Description

python program to get a String and reverse the characters of the string
Input:
Hello
Output:
olleH

Solution

s1=input("Enter a String:")
s2=""
j=len(s1)-1
while(j>=0):
    s2+=s1[j]
    j-=1
s1=s2
print(s1)
            
            
				

Explanation

visit each location in string s1 from the  last location len(l)-1 and append it to s2, finally store s2 in s1
Note:
String is immutable, so you cannot modify a character directly in a orginal string.



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution