Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

reverse string in python without using function

name = "Sharad"
reverse = "" #Empty String.
index = len(name) #index = 6

for ch in name:
	reverse = reverse + name[index-1] #indexing strats at zero i.e name[5]=d.
	index = index-1
 
print (name) 
print (reverse)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #reverse #string #python #function
ADD COMMENT
Topic
Name
9+2 =