Sure, the new_word[1:len(new_word)] is technically correct, however it takes up more space and is more prone to bugs than new_word[1:]. Why not add an extra step to teach that a skipped index is assumed to be the first/last one?
this way is actually more stable ,
because the first method will always run only up to new_word's length.
Are you implying that the second method won't?
Not at all what I'm saying is that the fist method is definite.
The second method is definite too. Also it would save you from a nasty bug if you were to rename your variables, e.g.:
new_word becomes temp_word, and you might end up with
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.