Don't like ads? PRO users don't see any ads ;-)
Guest

6.1

By: dvdjaco on Feb 18th, 2012  |  syntax: Python  |  size: 0.33 KB  |  hits: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # #!/usr/bin/python
  2. #
  3. # By dvdjaco
  4. # Exercise 6.1
  5. #
  6. # Write a while loop that starts at the last character in the string and works its way backwards to the first character in the string, printing each letter on a separate line, except backwards.
  7.  
  8. word = 'backwards'
  9. i = len(word) - 1
  10. while i >= 0:
  11.     print word[i]
  12.     i = i - 1