There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
In the “_1” version, the third argument in the calling statement depends upon the length of the input list. In the “_my” version, the third argument is a number, 4. The grader probably is testing on lists of varying length, not just the one you see.
That makes sense, I just didn’t understand the error message that came with the failing test because I was still printing the list elements in the correct order. Thanks for getting back to me!
start = 1
end = 1
start == end
A sub-list starting at index 1 and concluding at index 1
[“lasers”] This would actually return [] not [“lasers”]
start = 2
end = 1
start > end
A sub-list start index 2 and concluding at index 1
list[1:1] would return and
list[3,4] ie when start is greater then end will also return
I think the correct check for the base case should have been: start == end or start == end + 1
the exercise uses start>= end which also works but a different explanation should suffice instead of the one given
list is a reserved keyword. Albeit it is asked to use it as a parameter and do not have significant impact, it is not a good habit to take to use reserved keyword like that!
Not sure if this will be cleared in the future if we go more in depth with pointers, but the base case for our function ( if start >= end )seems problematic:
if start = 1 and end = 1list[1:1] will be []
if start = 0 and end = -1list[0:-1] can have any length, not limited to “one or zero elements”
Not sure if they read the comments on these forums. As a few others pointed out, list is a reserved keyword in Python and should not be used in code because it can produce unexpected outcomes. This is basic. Being an educational platform, they should fix it ASAP. People are already getting the wrong idea.