Skip to content

Commit 7fd6f72

Browse files
authored
Add files via upload
1 parent 0f8635d commit 7fd6f72

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Sun Jul 7 16:33:59 2019
4+
5+
@author: HP
6+
"""
7+
8+
# Defining a function to reverse a string
9+
10+
def reverse_a_string():
11+
# Reading input from console
12+
a_string = input("Enter a string")
13+
new_strings = []
14+
15+
# Storing length of input string
16+
index = len(a_string)
17+
18+
# Reversing the string using while loop
19+
while index:
20+
index -= 1
21+
new_strings.append(a_string[index])
22+
23+
#Printing the reversed string
24+
print(''.join(new_strings))
25+
26+
reverse_a_string()

0 commit comments

Comments
 (0)