Advertisement
Guest User

Untitled

a guest
Jul 9th, 2012
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. Exercise 6.1 Write a while loop that starts at the last character in the string and works its
  2. way backwards to the first character in the string, printing each letter on a separate line, except
  3. backwards.
  4. fruit='banana'
  5. i=len(fruit)
  6. while i>0:
  7.     print fruit[i-1],'\n'
  8.     i=i-1
  9.  
  10. Exercise 6.2 Given that fruit is a string, what does fruit[:] mean?
  11. fruit='banana'
  12. print fruit[:]
  13. Types the full string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement