Advertisement
dvdjaco

6.2

Feb 18th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. # #!/usr/bin/python
  2. #
  3. # By dvdjaco
  4. # Exercise 6.2
  5. #
  6. # Given that fruit is a string, what does fruit[:] mean?
  7. #
  8. # R: fruit[:] slices the string stored in the variable fruit starting in the beginning of the string and finishing in the end of the string, thus returning the same string.
  9.  
  10. fruit1 = 'apple'
  11. print fruit1
  12. print len(fruit1)
  13.  
  14. fruit2 = fruit1[:]
  15. print fruit2
  16. print len(fruit2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement