WEBVTT

00:00:00.790 --> 00:00:03.190
The following content is
provided under a Creative

00:00:03.190 --> 00:00:04.730
Commons license.

00:00:04.730 --> 00:00:07.030
Your support will help
MIT OpenCourseWare

00:00:07.030 --> 00:00:11.390
continue to offer high quality
educational resources for free.

00:00:11.390 --> 00:00:13.990
To make a donation or
view additional materials

00:00:13.990 --> 00:00:17.860
from hundreds of MIT courses,
visit MIT OpenCourseWare

00:00:17.860 --> 00:00:18.820
at ocw.mit.edu.

00:00:22.589 --> 00:00:24.130
ANA BELL: So the
question is, we have

00:00:24.130 --> 00:00:30.460
the string s is the string 600
is 6 triple 1 and 6 triple 2.

00:00:30.460 --> 00:00:33.204
So we're going to
create the string here.

00:00:33.204 --> 00:00:34.495
It's initially an empty string.

00:00:40.040 --> 00:00:46.530
I want to mention that the
plus equals-- for example,

00:00:46.530 --> 00:00:49.640
if I say a plus equals 1.

00:00:49.640 --> 00:00:54.149
This is equivalent to
a is equal to a plus 1.

00:00:54.149 --> 00:00:56.440
We've seen this a couple of
times before-- last lecture

00:00:56.440 --> 00:00:58.710
and the last
lecture before that.

00:00:58.710 --> 00:01:04.849
So all this means
here, this line here,

00:01:04.849 --> 00:01:07.280
is we're going to take the
previous string that we have,

00:01:07.280 --> 00:01:09.680
and we're just going
to add it to itself,

00:01:09.680 --> 00:01:11.460
plus the last letter.

00:01:11.460 --> 00:01:17.900
So the first thing we're going
to have is going to be new_str

00:01:17.900 --> 00:01:19.310
is equal to 2.

00:01:22.080 --> 00:01:24.180
Then this line here is
going to say now I'm

00:01:24.180 --> 00:01:28.650
going to add to the two
that I already have,

00:01:28.650 --> 00:01:31.380
the element at position
0, which is a 6.

00:01:31.380 --> 00:01:34.740
So I'm going to have 6.

00:01:34.740 --> 00:01:40.890
Then I'm going to add to
that, the element at index 4.

00:01:40.890 --> 00:01:42.390
So I'm starting count from 0.

00:01:42.390 --> 00:01:47.730
So this is 0, 1, 2, 3, 4.

00:01:47.730 --> 00:01:48.480
So that's a space.

00:01:51.240 --> 00:01:54.760
And I'm going to go--
notice I have 4, and then

00:01:54.760 --> 00:01:55.790
nothing in the middle.

00:01:55.790 --> 00:02:00.130
So my stop is going to
be length s by default.

00:02:00.130 --> 00:02:02.270
And I'm going to take
every 30 characters.

00:02:02.270 --> 00:02:06.460
Now every 30 is longer than
the actual string I have.

00:02:06.460 --> 00:02:12.307
So we're just going to end
at the end of the string.

00:02:12.307 --> 00:02:14.515
So the next thing that we're
going to add is a space.

00:02:17.784 --> 00:02:19.450
And then the last
thing we're doing here

00:02:19.450 --> 00:02:21.440
is we're starting at 13.

00:02:21.440 --> 00:02:25.360
So now I'm going to have to
count 13-- 0, 1, 2, 3, 4, 5, 6,

00:02:25.360 --> 00:02:29.130
8, 9, 10, 11, 12, 13.

00:02:29.130 --> 00:02:30.850
That's the 1.

00:02:30.850 --> 00:02:34.990
I'm going to go backward,
because of this minus 1.

00:02:34.990 --> 00:02:38.340
And I'm going to go
backward until 10, but right

00:02:38.340 --> 00:02:41.196
before 10-- so 1 less than 10.

00:02:41.196 --> 00:02:44.660
So I'm going to do 100.

00:02:44.660 --> 00:02:47.654
So this one, this
0, and then this 0.

00:02:47.654 --> 00:02:49.320
Then I'm going to
print this new string.

00:02:52.794 --> 00:02:53.710
I think this is right.

00:02:53.710 --> 00:02:57.760
If you paste it into Spider, it
should give you 26 space 100.

00:02:57.760 --> 00:03:01.550
So I think most of the
class got it right.

00:03:01.550 --> 00:03:03.020
I think, yes.

00:03:03.020 --> 00:03:04.570
Perfect.