Transcript
The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseware continue to offer high-quality educational resources for free. To make a donation or view additional materials from hundreds of MIT courses, visit MIT OpenCourseware at ocw.mit.edu. So, the question is, we have the string S. Is the string 600 is 611 and 6002? So, we're going to create this string here, right? It's initially an empty string. Uh I want to mention that the plus equals for example, if I say A plus equals 1, this is equivalent to A is equal to A plus 1. Okay? We've seen this a couple times before, last lecture and the lecture before that.
So, all this means here, this line here, is we're going to take the previous string that we have and we're just going to add it to itself plus the last letter. So, the first thing we're going to have is going to be new underscore str is equal to two. Then this line here is going to say, now I'm going to add to the to the two that I already have the element at position zero, which is a six. So, I'm going to have six. Then I'm going to add to that the element at position at index four. So, I'm starting to count from zero, so this is zero, one, two, three, four. Right? So, that's a space. And I'm going to go Notice I have four and then nothing in the middle, so my stop is going to be length S by default.
And I'm going to take every 30 characters. Now, every 30 is longer than the actual string I have, right? So, we're just going to end at the end of the string. So, this is the next thing that we're going to add is a space. Okay? And then the last thing we're doing here is we're starting at 13. So, now I'm going to have to count 13. 0 1 2 3 4 5 6 8 9 10 11 12 13. That's the one. I'm going to go backward because of this minus one. And I'm going to go backward until 10, but right before 10. Okay? So, one less than 10. So, I'm going to do one hundred. So, this one, this zero, and then this zero. Okay?
And then I'm going to print this new string. I think this is right. If you paste it into Spyder, it should give you 26 space 100. So, I think most of the class got it right. Yes, perfect.