6. Slicing lists and strings



It says Oops, try again. It looks like dog contains 'do' instead of 'dog'

It should say I did it correctly but this is not the case

animals = "catdogfrog"
cat  = animals[:3]  # The first three characters of animals
dog  = animals[3:5] # The fourth through sixth characters
frog = animals[6:]  # From the seventh character to the end
print cat
print dog
print frog


Which is true. The dog slice is incorrect.


Could you help me correct it?


You're very close.

0 1 2 3 4 5 6 7 8 9 0
c a t d o g f r o g


Thank you, I corrected it


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.