Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # #!/usr/bin/python
- #
- # By dvdjaco
- # Exercise 6.2
- #
- # Given that fruit is a string, what does fruit[:] mean?
- #
- # 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.
- fruit1 = 'apple'
- print fruit1
- print len(fruit1)
- fruit2 = fruit1[:]
- print fruit2
- print len(fruit2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement