Reverse the String in python
python program to get a String and reverse the characters of the string
Sample Input 1:
Hello
Sample Output 1 :
olleH
Try your Solution
Strongly recommended to Solve it on your own, Don't directly go to the solution given below.
#write your code here
Program or Solution
s1=input("Enter a String:")
s2=""
j=len(s1)-1
while(j>=0):
s2+=s1[j]
j-=1
s1=s2
print(s1)
Program 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.Comments
Related Programs
- length of the string in python
- find a character in a String Python
- occurences of character in string python
- lowercase to uppercase in python
- uppercase to lowercase in python
- python count vowels in string
- Compare two Strings in python
- find vowels in string python
- find substring in string pyhton
- occurences of substring in a String python
- string Palindronme in python
- Remove the spaces in String python
- Remove the Vowels in String Python
coming Soon
coming Soon