1
00:00:00,670 --> 00:00:08,230
You saw me previously use methods and functions and other methods such as capitalize.

2
00:00:08,470 --> 00:00:11,470
So how do I know all these methods?

3
00:00:11,500 --> 00:00:16,420
Is it because I'm too smart, or is there another secret?

4
00:00:16,450 --> 00:00:19,060
Well, I assure you that is the latter.

5
00:00:19,480 --> 00:00:24,760
So let me show you the secret on how to find the codes you need in this video.

6
00:00:26,480 --> 00:00:31,370
Using the Python console is recommended for such things.

7
00:00:31,370 --> 00:00:36,710
So when you want to explore things out, when you want to test things out, it's good to use the python

8
00:00:36,710 --> 00:00:37,430
console.

9
00:00:38,180 --> 00:00:42,170
So let's say again you want to capitalize a string.

10
00:00:42,500 --> 00:00:44,660
How do you know what methods to use?

11
00:00:44,690 --> 00:00:51,200
Well you can simply use dir str.

12
00:00:52,250 --> 00:00:57,350
Execute that and what you get is a list as output.

13
00:00:58,300 --> 00:01:05,370
So this list contains all the methods you can apply to a string data type.

14
00:01:05,379 --> 00:01:07,240
Because you know I did.

15
00:01:07,300 --> 00:01:11,980
D str str represents strings.

16
00:01:12,520 --> 00:01:19,750
So this is a keyword in Python, although you can also use any string there and you'll get the same

17
00:01:19,780 --> 00:01:20,650
output.

18
00:01:20,740 --> 00:01:29,980
So either use STR the keyword representing the string type or an actual instance of a string.

19
00:01:30,940 --> 00:01:32,650
So this list is.

20
00:01:34,360 --> 00:01:36,190
Made of these.

21
00:01:37,790 --> 00:01:42,800
Methods with double underscores, but you don't need to look at them.

22
00:01:42,810 --> 00:01:44,750
You don't need to use them.

23
00:01:44,750 --> 00:01:47,990
These are used internally by the python interpreter.

24
00:01:48,020 --> 00:01:55,280
The methods we're interested about are after these underscore methods.

25
00:01:56,060 --> 00:01:58,640
So for example, capitalize is the first one.

26
00:01:58,640 --> 00:02:01,730
So they are ordered alphabetically.

27
00:02:04,290 --> 00:02:10,610
So you should get a clue of what the method does by just looking at the name of the method.

28
00:02:10,620 --> 00:02:15,300
But then if you want to know more about the method you can use.

29
00:02:16,720 --> 00:02:18,130
The health function.

30
00:02:18,610 --> 00:02:27,850
The health function gets as input the method, but you need to refer to a string first and then to the

31
00:02:27,850 --> 00:02:28,540
method.

32
00:02:29,410 --> 00:02:35,230
So str or just do any string dot capitalize.

33
00:02:35,350 --> 00:02:40,870
You don't put any brackets here, any parentheses, just capitalize like that.

34
00:02:41,440 --> 00:02:45,880
And these parentheses of the help function and press enter.

35
00:02:46,990 --> 00:02:53,140
And what you get is the help documentation of that capitalized method.

36
00:02:54,400 --> 00:02:57,700
So it explains what that method does.

37
00:02:59,590 --> 00:03:04,760
And similarly you can use there with a list.

38
00:03:04,780 --> 00:03:13,060
So list like that, or just do an empty list instance or any items you might have there.

39
00:03:13,360 --> 00:03:16,180
And you can also use a variable.

40
00:03:16,180 --> 00:03:24,370
So if the variable is associated with a list one, two, three and you do dear A, you will get the

41
00:03:24,370 --> 00:03:30,070
list of methods that can be applied to list objects.

42
00:03:33,450 --> 00:03:37,560
So here you can see all the methods you can apply to lists.

43
00:03:37,770 --> 00:03:49,140
So you see the append method and again, use help list dot append to get the help of that method.

44
00:03:49,830 --> 00:03:51,540
Now see something here.

45
00:03:52,080 --> 00:03:55,950
This append method has these two.

46
00:03:57,650 --> 00:04:01,070
Arguments self and object.

47
00:04:01,880 --> 00:04:10,220
But let's take a look again back to the capitalize method.

48
00:04:10,230 --> 00:04:15,130
So help capitalize and compare them.

49
00:04:15,140 --> 00:04:20,630
You see, capitalize doesn't get any argument as input.

50
00:04:21,300 --> 00:04:25,290
So that is some clue on how to use the methods.

51
00:04:25,290 --> 00:04:28,860
So with capitalize, we just put the string and say capitalize.

52
00:04:30,750 --> 00:04:31,370
And that's it.

53
00:04:31,380 --> 00:04:32,310
No arguments.

54
00:04:32,310 --> 00:04:36,060
And you get the capitalized string but with lists.

55
00:04:37,100 --> 00:04:41,360
We have at least a so A is that one with lists?

56
00:04:41,390 --> 00:04:43,640
You say a dot append.

57
00:04:44,150 --> 00:04:53,810
And here if you execute this, you will get an error because the append method takes one argument.

58
00:04:54,750 --> 00:04:58,200
So you need to provide an argument there.

59
00:04:58,200 --> 00:05:03,360
And then A will be that list with the full appended to the end.

60
00:05:04,230 --> 00:05:06,090
So that's why I showed you.

61
00:05:08,780 --> 00:05:09,980
This part here.

62
00:05:10,010 --> 00:05:11,360
Now what is self?

63
00:05:11,360 --> 00:05:12,110
Well, self.

64
00:05:12,140 --> 00:05:13,490
You can ignore this for now.

65
00:05:13,490 --> 00:05:15,290
We will cover self later.

66
00:05:15,980 --> 00:05:19,520
The real argument here is this object.

67
00:05:19,520 --> 00:05:28,580
So the object is the number you want to pass to the append method, the number or a string if you want

68
00:05:28,580 --> 00:05:30,590
to append the string to the list.

69
00:05:30,680 --> 00:05:38,300
So to wrap it up so far, you learned there where you put a type and you get the list of the methods

70
00:05:38,390 --> 00:05:40,490
applied to that type.

71
00:05:40,710 --> 00:05:45,860
Then you so you can use help on a particular.

72
00:05:48,960 --> 00:05:49,710
Method.

73
00:05:50,640 --> 00:05:53,550
But then how about functions?

74
00:05:53,550 --> 00:05:56,700
How do you get a list of functions you can apply?

75
00:05:56,730 --> 00:06:01,110
So a function is print input is a function also.

76
00:06:01,230 --> 00:06:09,000
Well, to get a list of available functions in Python, you first need to import built ins.

77
00:06:11,120 --> 00:06:18,860
Now, this is an import statement in Python and I'll talk about import statements later on in the course.

78
00:06:18,860 --> 00:06:21,740
So for now, we're simply using this.

79
00:06:22,250 --> 00:06:25,910
So we make available the list of built ins.

80
00:06:25,910 --> 00:06:28,340
So now this built ins can be

81
00:06:31,280 --> 00:06:34,610
provided as an argument of the function.

82
00:06:34,610 --> 00:06:38,990
And if you execute that, you will get a list.

83
00:06:42,990 --> 00:06:49,560
Of these functions and other elements which you can apply directly without the dot notation.

84
00:06:49,710 --> 00:06:54,210
So input should be among this.

85
00:07:00,820 --> 00:07:09,880
So you should get past these elements with a capital letter and you should pass also these underscore

86
00:07:09,880 --> 00:07:10,540
elements.

87
00:07:10,540 --> 00:07:13,330
And then here we have different functions.

88
00:07:13,330 --> 00:07:17,710
So these with lowercase are all functions.

89
00:07:23,580 --> 00:07:26,280
And here should be the input function.

90
00:07:26,280 --> 00:07:27,360
So that's inputs.

91
00:07:27,360 --> 00:07:32,400
If you go to the P letter, you should also be able to find the print function.

92
00:07:32,400 --> 00:07:33,390
Here it is.

93
00:07:35,140 --> 00:07:42,190
Now, you don't need to actually look at this list and learn everything that it is here.

94
00:07:43,570 --> 00:07:46,510
I also don't know all these functions.

95
00:07:47,910 --> 00:07:49,830
Some are very specific ones.

96
00:07:49,830 --> 00:07:57,210
So if you need to know how to do something, it's easier to do some research on Google because most

97
00:07:57,210 --> 00:08:03,570
likely someone else has done that thing before and there is a discussion or some source.

98
00:08:04,570 --> 00:08:12,050
On a forum or a blog which shows what functions you can use in Python for that particular thing.

99
00:08:12,070 --> 00:08:15,880
So what is important is to know the logic of.

100
00:08:16,620 --> 00:08:17,850
Building a program.

101
00:08:17,850 --> 00:08:22,170
And this is what I'm trying to teach you in this course.

102
00:08:22,170 --> 00:08:29,160
So we will build a number of programs and you will understand the logic and also learn the core elements

103
00:08:29,160 --> 00:08:35,750
of the language, such as the input function, the while loop least strings, etcetera.

104
00:08:35,760 --> 00:08:38,220
All these are the core concepts.

105
00:08:38,549 --> 00:08:41,610
So don't worry about these elements here.

106
00:08:43,570 --> 00:08:44,710
I hope that makes sense.

107
00:08:44,710 --> 00:08:45,880
And I'll talk to you later.

108
00:08:45,910 --> 00:08:46,360
See you.

