- 2
Write a program in python to reverse a string using for loop and forward indexing.
3 Respostas
+ 2
def reverse(s):
str = ""
for i in s:
str = i + str
return str
Or simply you can do
print (str [::-1])
+ 2
https://www.sololearn.com/discuss/1613864/?ref=app
https://www.sololearn.com/discuss/2143844/?ref=app
https://www.sololearn.com/discuss/2280068/?ref=app
https://www.sololearn.com/discuss/1919460/?ref=app
https://www.sololearn.com/discuss/1748913/?ref=app
https://www.sololearn.com/discuss/1470297/?ref=app
Please, before you ask question, check, maybe someone asked it before you.
+ 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