
6.2
By:
dvdjaco on
Feb 18th, 2012 | syntax:
Python | size: 0.40 KB | hits: 26 | expires: Never
# #!/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)