Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:01,380 --> 00:00:03,090
This one here is a list
1
2
00:00:05,800 --> 00:00:14,990
and now it is a tuple so a tuple is just like a list but with parentheses not square brackets.
2
3
00:00:15,700 --> 00:00:21,000
If you print it out of course you'd get the same representation as in here.
3
4
00:00:21,010 --> 00:00:23,130
So (1, 4, 5) (1, 4, 5).
4
5
00:00:23,780 --> 00:00:30,940
However the brackets and the parentheses is not the only difference between lists and tuples.
5
6
00:00:30,940 --> 00:00:33,730
In fact this is just the difference in syntax.
6
7
00:00:33,730 --> 00:00:45,440
The real difference there is that tuples such as this one in here are immutable and lists such as this
7
8
00:00:45,440 --> 00:00:45,680
one
8
9
00:00:49,070 --> 00:00:50,240
are mutable.
9
10
00:00:50,270 --> 00:01:01,110
What that means is at the list monday_temperatures2 you can add more items to the list using for example
10
11
00:01:01,110 --> 00:01:03,600
the append methods.
11
12
00:01:03,600 --> 00:01:10,590
So if you check monday_temperatures too know you'll get a list mutated. This mutability makes this
12
13
00:01:10,590 --> 00:01:17,730
very dynamic, you'll see you later how when we do this batch operations in each operation we are adding
13
14
00:01:17,730 --> 00:01:23,730
items to the list as we generate those items those values with some functions.
14
15
00:01:24,060 --> 00:01:31,530
But this is not the case with tuples. If you try to append in a tuple you'll get an error because the
15
16
00:01:31,530 --> 00:01:34,560
tuple doesn't actually have an offensive method at all.
16
17
00:01:35,730 --> 00:01:42,510
Likewise it doesn't have a remove method like the list does
17
18
00:01:45,410 --> 00:01:52,430
so 4 is not there anymore, tuples however have the advantage that they are a bit faster than lists
18
19
00:01:53,180 --> 00:02:00,300
but you should think what to use so whether to use lists or tuples you should think if the array you
19
20
00:02:00,290 --> 00:02:07,190
are creating is going to be changed during the course of the program or not.
20
21
00:02:07,730 --> 00:02:11,950
So for now I'm not going deeper into tuples and lists.
21
22
00:02:12,290 --> 00:02:18,020
But when we create these 10 applications during the course you will understand the main differences
22
23
00:02:18,230 --> 00:02:22,310
between the two by seeing how they work in the real programs.
2544
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.