Created
October 15, 2020 06:40
-
-
Save gkfarwaha/1a9aac0717bf82819fa850a1ae2b17a2 to your computer and use it in GitHub Desktop.
reversing the string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET YOUR LINE PRINTED BACKWARDS | |
print("Enter the string you want to print backward") | |
str1 = input() | |
print("String entered by you as follows\n", str1) | |
print("String entered by you in upper case as follows\n", str1.upper()) | |
print("String entered by you in lower as follows\n", str1.lower()) | |
x = int(len(str1)) | |
print("Length of the string: ", x) | |
i = x | |
print(type(i)) | |
revstr = "" | |
while i > 0: | |
i -= 1 | |
revstr += str1[i] | |
print(revstr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment