Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
davidbrenton
Group Title
I don't understand the logic behind the use of two or more colons (Example Pset7 problem 19: result of str4[1:9:2])
 one year ago
 one year ago
davidbrenton Group Title
I don't understand the logic behind the use of two or more colons (Example Pset7 problem 19: result of str4[1:9:2])
 one year ago
 one year ago

This Question is Open

davidbrenton Group TitleBest ResponseYou've already chosen the best response.0
I found the logic behind this problem on stackoverflow.com since my textbook hasn't yet arrived. I copied the logic from there and pasted below: s[i:j:k] slice of s from i to j with step k The slice of s from i to j with step k is defined as the sequence of items with index x = i + n*k such that 0 <= n < (ji)/k. In other words, the indices are i, i+k, i+2*k, i+3*k and so on, stopping when j is reached (but never including j). If i or j is greater than len(s), use len(s). If i or j are omitted or None, they become “end” values (which end depends on the sign of k). Note, k cannot be zero. If k is None, it is treated like 1.
 one year ago

bwCA Group TitleBest ResponseYou've already chosen the best response.0
the info is also in the documentation
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.