Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialsonam rathore
703 Pointswhat is the answer for this question?
what are the three parts of slice syntax?
3 Answers
Iain Simmons
Treehouse Moderator 32,305 PointsWe're actually not meant to just give away the answers here on the forums. That doesn't help anyone learn.
You should get used to searching for your answers, starting from the official documentation, but you'll often find yourself on sites like Stack Overflow.
Here's a page on the Python docs that should help you find the answer you're looking for:
Denis Gathondu
Python Web Development Techdegree Student 3,006 PointsThe slice syntax is composed on a start value, a stop value, and a step value.
Robert Stefanic
35,170 PointsThe slice syntax is composed on a start value, a stop value, and the increment value.
my_list[start:stop:increment]
So as an example, say you wanted to print the odd numbers from a list of numbers, 1 - 10.
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_list[0:9:2]
# [1, 3, 5, 7, 9]