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 trialDhruv Ghulati
1,582 PointsNo idea how to "name three parts of slice syntax"
Hi - I know how to finish the sillycase() function but I have no idea about the quiz - how do I answer that question? I am not sure about the relevancy of that question also from a learning standpoint. is it [number:number:number]?
9 Answers
Sean M
7,344 PointsI found it easier to understand if you just picture writing a loop in python
for x in range(2, 30, 3):
print(x)
2 = start at 2 30 = stop before 30 3 = increment by 3 as we go from 2-30
MZ140542 Edwin Chawabvunza
2,432 PointsHey Kenneth Love, I have a question, though your answer worked, isn't the order supposed to be start:step:stop?
Kenneth Love
Treehouse Guest TeacherNope. You name where you want to start, then where you want to stop, then how many steps to take each time. Start, stop, step.
Sandeep sIngh
Courses Plus Student 1,659 Pointsit should be start:stop:step
Andrea Moulding
8,287 PointsAndrea Moulding
8,287 PointsI kept messing up because I thought the last one was stride!
eyeloveotters
15,097 PointsWay to reference the documentation!
Dhruv Ghulati
1,582 PointsI can only think of [lowerbound:upperbound:stride] as a way of defining what goes into the gaps - in the documentation it has:
proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" [stride] ] lower_bound ::= expression upper_bound ::= expression stride ::= expression
So what goes into the first 2 gaps which both start with "st"?
Kenneth Love
Treehouse Guest TeacherIt's in the last paragraph of the section that I linked you to. Start, stop, and step.
beven nyamande
9,575 Pointsname = 'beven'
print(name[:]) # prints the string "beven"
print(name[:2]) # from start at index to 2
print(name[::-1]) # reverses the string prints 'neveb'
beven nyamande
9,575 Pointsremember to mark best if it was useful
Dhruv Ghulati
1,582 PointsHi,
The question mentions that each section begins with "st" - that was my question - no idea what to insert apart from "string" in the blanks!
Kenneth Love
Treehouse Guest TeacherWe talk about it several times in the videos and it's in the documentation for slices, too.
MZ140542 Edwin Chawabvunza
2,432 Pointsyeah! I got it thanks
Kyle Cohne
1,880 PointsEh had the right terms just messed up the stop, step order.