Skip to content

Instantly share code, notes, and snippets.

@sweded
Created October 16, 2012 21:24
Show Gist options
  • Save sweded/3902143 to your computer and use it in GitHub Desktop.
Save sweded/3902143 to your computer and use it in GitHub Desktop.
As an exercise, write a function that takes a string as an argument and outputs the letters backward, one per line.
fruit = "banana"
def revFruit(fruit):
index = len(fruit)-1
while index >= 0:
letter = fruit[index]
print letter
index = index - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment