Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:00,580 --> 00:00:00,890
OK.
1
2
00:00:00,920 --> 00:00:04,820
So you know strings, you know floats, you know integers, you know lists.
2
3
00:00:04,850 --> 00:00:05,280
OK.
3
4
00:00:05,310 --> 00:00:06,330
So you know data types.
4
5
00:00:06,360 --> 00:00:09,720
But how can you actually do something in Python?
5
6
00:00:09,780 --> 00:00:12,390
What can you do with these data types?
6
7
00:00:12,390 --> 00:00:19,260
Well to answer your question you should look at the dir command.
7
8
00:00:19,260 --> 00:00:25,640
Well let me now start to use the Python shell a little bit more to do things quicker.
8
9
00:00:25,710 --> 00:00:28,440
So I'm going to split this into two.
9
10
00:00:28,440 --> 00:00:31,860
This is for executing the Python file.
10
11
00:00:31,860 --> 00:00:35,550
This is for the interactive Python shell.
11
12
00:00:35,550 --> 00:00:38,040
So what can we do with lists?
12
13
00:00:38,070 --> 00:00:40,470
You can find that out by doing dir.
13
14
00:00:40,470 --> 00:00:44,220
Dir is a function in Python that will give you
14
15
00:00:48,190 --> 00:00:52,530
all the things you can do with a specific type.
15
16
00:00:52,540 --> 00:01:03,190
So with a list in this case, all these here are attributes of a list, you can do the same for checking int.
16
17
00:01:06,010 --> 00:01:15,990
You can do the same for checking floats, dr float, dir str.
For example let's stop at str before
17
18
00:01:15,990 --> 00:01:25,050
we go to lists, with a string you can do for example, you can turn them into uppercase using these method.
18
19
00:01:26,100 --> 00:01:30,000
To find out what upper does you want to use
19
20
00:01:30,000 --> 00:01:40,620
help str, that is the type that has the attributes upper.
Now attributes are all these, and they can be
20
21
00:01:40,950 --> 00:01:43,410
either methods or properties.
21
22
00:01:43,530 --> 00:01:46,800
You do know that until you check with help.
22
23
00:01:51,950 --> 00:01:56,760
So that is the help documentation for the upper method.
23
24
00:01:56,780 --> 00:02:05,990
It's a method as you can see here. Q to quit and go back to the shell and then let's go ahead and use
24
25
00:02:05,990 --> 00:02:06,350
that.
25
26
00:02:06,920 --> 00:02:08,190
"hello"
26
27
00:02:08,210 --> 00:02:17,540
dot upper, you use the method with round brackets,
with parentheses and that's with the return
27
28
00:02:17,540 --> 00:02:28,010
the capitalized version of "HELLO". If we used title instead that will capitalize the first letter only.
28
29
00:02:28,940 --> 00:02:32,180
Of course you can use variables
29
30
00:02:39,280 --> 00:02:40,770
and you get the same output.
30
31
00:02:40,900 --> 00:02:44,680
Now what do we have for lists?
31
32
00:02:44,680 --> 00:02:49,040
How about calculating the average of the student grades?
32
33
00:02:49,070 --> 00:02:50,350
Let's do that in the next video.
3079
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.