6. Slicing lists and strings


#1

https://www.codecademy.com/courses/python-beginner-en-pwmb1/1/3?curriculum_id=4f89dab3d788890003000096

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

#2

Which is true. The dog slice is incorrect.


#3

Could you help me correct it?


#4

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

#5

Thank you, I corrected it


#6

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