- 2

Write a program in python to reverse a string using for loop and forward indexing.

24th Jun 2020, 12:27 PM
Shruti Rani
Shruti Rani - avatar
3 Réponses
+ 2
def reverse(s):   str = ""   for i in s:     str = i + str   return str Or simply you can do print (str [::-1])
24th Jun 2020, 12:39 PM
Ankit Yadav
Ankit Yadav - avatar
+ 2
Do not post your assignments or homework for the community ,pls add what you have attempted so far and ask a specific question if you need help
24th Jun 2020, 12:45 PM
Abhay
Abhay - avatar