1
00:00:03,070 --> 00:00:03,430
Okay.

2
00:00:03,430 --> 00:00:15,160
So we are going to use this, uh, way of dividing the screen like in a other sessions in order to continue

3
00:00:15,160 --> 00:00:16,990
with this practice.

4
00:00:17,020 --> 00:00:26,650
So in this presentation, we are going to learn only what you need to know about Python and JavaScript

5
00:00:26,650 --> 00:00:30,340
in order to develop LM applications.

6
00:00:30,460 --> 00:00:39,280
As you know, Python and JavaScript are, uh, two very big languages and you can find books and books

7
00:00:39,280 --> 00:00:46,930
about Python and also about JavaScript and sometimes rookies, as I did when I was a rookie.

8
00:00:47,350 --> 00:00:56,620
We waste so much time trying to learn and understand everything about Python and everything about JavaScript

9
00:00:56,620 --> 00:01:00,010
before starting to, uh, program.

10
00:01:00,010 --> 00:01:10,120
And this is a mistake as every rookie has learned, uh, you only need a small piece of a programming

11
00:01:10,120 --> 00:01:15,070
language in order to develop a particular kind of applications.

12
00:01:15,070 --> 00:01:19,090
And this is exactly what happens with LM applications.

13
00:01:19,090 --> 00:01:29,080
So the purpose of this lesson is to save you a lot of time and to tell you only what matters, only

14
00:01:29,080 --> 00:01:34,120
the things that you will need to understand in Python and JavaScript.

15
00:01:34,120 --> 00:01:37,630
And I say understand, not memorize.

16
00:01:37,630 --> 00:01:42,940
Because as you know, today, programming is not about memory.

17
00:01:42,940 --> 00:01:52,390
It's about understanding what you need to do and understanding where to look for a solutions.

18
00:01:52,390 --> 00:01:58,270
Whenever you have a doubt or a question and remember who is your best friend when you are programming,

19
00:01:58,270 --> 00:02:03,160
always have ChatGPT for open in order to help you.

20
00:02:03,160 --> 00:02:06,280
This is your personal assistant when you are programming.

21
00:02:06,820 --> 00:02:12,700
So we are going to use two notebooks and that you will have attached.

22
00:02:12,700 --> 00:02:19,840
And in these two notebooks we are going to do exactly the same in Python and in JavaScript.

23
00:02:21,170 --> 00:02:30,980
So Python, as you know, is the most common programming language in artificial intelligence traditionally.

24
00:02:31,100 --> 00:02:41,660
So Long chain was written initially in Python and Llama index and, you know, ChatGPT exact, etc.

25
00:02:41,660 --> 00:02:49,880
so Python has always been the programming language for artificial intelligence, uh, engineers and

26
00:02:49,880 --> 00:02:53,780
also machine learning, deep learning, etc., etc..

27
00:02:54,320 --> 00:03:02,030
So this is very important to know because most of the artificial intelligence frameworks we are going

28
00:03:02,030 --> 00:03:05,390
to be working with are written in Python.

29
00:03:05,390 --> 00:03:07,070
So this is important.

30
00:03:07,160 --> 00:03:14,660
Second important thing we can use Python for server side application development.

31
00:03:14,660 --> 00:03:22,250
This is not the only option we have, but it's going to be very frequent at least right now.

32
00:03:22,640 --> 00:03:30,470
So for example, when we look at fast API, which is one of the frameworks we are going to to, to look

33
00:03:30,470 --> 00:03:35,090
in the in the next sections, in this case is a server side framework.

34
00:03:35,090 --> 00:03:39,050
We we will see that this is a Python framework.

35
00:03:39,050 --> 00:03:43,910
So there are other server side frameworks.

36
00:03:43,910 --> 00:03:53,630
But it is very common in artificial intelligence applications to see Python a frameworks in the server

37
00:03:53,630 --> 00:03:55,790
side of the applications.

38
00:03:55,790 --> 00:03:56,240
Okay.

39
00:03:56,240 --> 00:03:59,000
So Python is is going to be very important for us.

40
00:03:59,000 --> 00:04:06,080
So it's very good that you are familiar and you are comfortable with Python, especially with the areas

41
00:04:06,080 --> 00:04:09,470
of Python we are going to cover in this presentation.

42
00:04:09,680 --> 00:04:20,450
JavaScript on the other hand, is a language that is the most common language used for web applications.

43
00:04:20,810 --> 00:04:31,100
So in the web era, especially in the second stage of the web era, JavaScript has been the king, mostly

44
00:04:31,100 --> 00:04:36,830
in front end, but also in back end with frameworks like Node.js.

45
00:04:36,890 --> 00:04:44,420
So JavaScript has been extremely important in the application development world because as you know,

46
00:04:44,420 --> 00:04:49,640
application development means web application development in the last 30 years.

47
00:04:49,640 --> 00:04:51,860
So JavaScript is very, very important.

48
00:04:51,860 --> 00:05:00,410
And remember that when we are talking about LM application development, we are going to develop web

49
00:05:00,410 --> 00:05:01,640
applications as well.

50
00:05:01,640 --> 00:05:04,820
So JavaScript is going to be important for us.

51
00:05:04,820 --> 00:05:09,380
Mostly it's going to be important for us in the front end development.

52
00:05:09,650 --> 00:05:14,420
But in some cases it can also be important in the back end development.

53
00:05:14,420 --> 00:05:21,230
But for us, we are going to see JavaScript when we see a React Next.js.

54
00:05:21,230 --> 00:05:22,610
And also Vercel.

55
00:05:22,610 --> 00:05:25,130
So JavaScript is important for us.

56
00:05:25,130 --> 00:05:28,340
What is going to happen in the future?

57
00:05:29,330 --> 00:05:41,930
Today a I have already told you that JavaScript is going to to be more and more common into the, uh,

58
00:05:41,930 --> 00:05:44,540
artificial intelligence community.

59
00:05:44,900 --> 00:05:53,960
Um, because previously the artificial intelligence community, they didn't develop web applications

60
00:05:53,960 --> 00:05:56,420
the same way they are doing today.

61
00:05:56,420 --> 00:06:03,020
So today we artificial intelligence engineers are using JavaScript on a daily basis.

62
00:06:03,020 --> 00:06:10,280
And apart from that, a lot of the traditional web applications developers that are used to work with

63
00:06:10,280 --> 00:06:15,350
JavaScript are being interested in using LM applications as well.

64
00:06:15,350 --> 00:06:23,870
And that's the reason why LM app development frameworks like Lang Smith and uh, Llama Index, they

65
00:06:23,870 --> 00:06:29,330
are preparing to welcome these all JavaScript developers.

66
00:06:29,330 --> 00:06:36,200
And that's why you see today that Lang Smith, for example, is written in Python but has a JavaScript

67
00:06:36,200 --> 00:06:38,600
version and the same thing with llama index.

68
00:06:38,600 --> 00:06:42,020
So what is going to happen in the future?

69
00:06:42,230 --> 00:06:50,060
In my opinion, we are going to see more and more use of JavaScript in the LM app development framework

70
00:06:50,060 --> 00:06:50,600
world.

71
00:06:50,600 --> 00:06:53,270
But that's just a guess.

72
00:06:53,270 --> 00:06:56,300
I think Python is going to be important.

73
00:06:56,300 --> 00:06:58,670
It's going to to to remain very important.

74
00:06:58,670 --> 00:07:02,360
But I think the importance of JavaScript is going to increase.

75
00:07:02,360 --> 00:07:06,500
Let's see what happens in the future because no one knows uh, right now.

76
00:07:06,500 --> 00:07:15,320
So let's talk about some things that are similar and things that are different in Python and JavaScript

77
00:07:15,320 --> 00:07:20,390
and most of it things that are important for us as an.

78
00:07:21,040 --> 00:07:23,020
LM application developers.

79
00:07:23,020 --> 00:07:26,530
So let's talk initially about syntax.

80
00:07:26,530 --> 00:07:34,780
So as you see in this, uh, in this notebook in the right side of the screen, you have a, the things

81
00:07:34,780 --> 00:07:36,340
applied to Python.

82
00:07:36,340 --> 00:07:40,750
And here you have the same things applied to JavaScript.

83
00:07:40,750 --> 00:07:41,440
Okay.

84
00:07:42,280 --> 00:07:52,300
So initially we start talking about the syntax a things to highlight about the syntax in Python and

85
00:07:52,300 --> 00:07:53,230
in JavaScript.

86
00:07:53,230 --> 00:07:54,280
Very simple.

87
00:07:54,280 --> 00:08:00,550
In Python, as you already know, we don't use semicolon at the end of the lines.

88
00:08:01,520 --> 00:08:03,710
In JavaScript, we do.

89
00:08:03,710 --> 00:08:10,550
So whenever you write something like this, for example, and you want to start a new line, you need

90
00:08:10,550 --> 00:08:12,260
to enter semicolon.

91
00:08:14,430 --> 00:08:19,980
In Python is very important to use indentation properly.

92
00:08:19,980 --> 00:08:28,920
So if you go to the Python uh, file here, you will see that indentation is very important.

93
00:08:28,920 --> 00:08:38,070
And this is something sometimes, um, problematic in the Python world because usually indentation is,

94
00:08:38,250 --> 00:08:46,380
you know, like the pure Python developers, they use four spaces instead of the tab key.

95
00:08:46,410 --> 00:08:49,470
You know, most of us we use the tab key.

96
00:08:49,470 --> 00:08:53,370
But sometimes the the tab key is problematic.

97
00:08:53,370 --> 00:08:57,300
So if you some is very rare.

98
00:08:57,300 --> 00:09:07,950
But if you find a problem with indentation, a thing that maybe your code editor is not using the tab

99
00:09:07,950 --> 00:09:11,370
key in a proper way, usually it doesn't happen.

100
00:09:11,370 --> 00:09:18,090
I use the tab key every every time, but uh, just be aware of it.

101
00:09:18,210 --> 00:09:24,630
The purest Python developers they use for spaces instead of a tab.

102
00:09:24,660 --> 00:09:27,690
Okay, so indentation is important in Python.

103
00:09:27,690 --> 00:09:30,120
In JavaScript it doesn't matter.

104
00:09:30,990 --> 00:09:38,430
And another interesting thing about the syntax is that in Python we don't need to declare variables.

105
00:09:38,430 --> 00:09:41,610
So we we can say x equal four.

106
00:09:41,610 --> 00:09:42,330
And that's it.

107
00:09:42,330 --> 00:09:46,200
Python understands that x is of type integer.

108
00:09:46,740 --> 00:09:49,680
In some cases we want to declare variables.

109
00:09:49,680 --> 00:09:53,970
And we can we can say y equals string four.

110
00:09:53,970 --> 00:10:01,080
And now instead of being an integer Python understands that the variable y is of type string.

111
00:10:01,350 --> 00:10:03,090
In JavaScript.

112
00:10:04,120 --> 00:10:12,070
A you will see that a the variables used to be declared.

113
00:10:12,730 --> 00:10:16,300
A traditionally we use the keyword var.

114
00:10:16,690 --> 00:10:19,210
Now the new keyword is let.

115
00:10:19,210 --> 00:10:21,760
So var is just the old way.

116
00:10:21,760 --> 00:10:30,280
Now everybody uses let, but in some cases you will see that you need to declare variables anymore in

117
00:10:30,280 --> 00:10:30,820
JavaScript.

118
00:10:30,820 --> 00:10:37,060
So you will see that the new versions of JavaScript are more and more similar to Python.

119
00:10:37,270 --> 00:10:45,820
One interesting thing here that we are highlighting here in this notebook about JavaScript.

120
00:10:47,070 --> 00:10:55,920
Is that a JavaScript is a is a web language as as you remember notebooks.

121
00:10:56,010 --> 00:10:57,780
This, this these are notebooks.

122
00:10:57,780 --> 00:11:03,870
The notebooks are used initially, you know, designed to work for Python.

123
00:11:03,870 --> 00:11:07,380
And we are using a trick here.

124
00:11:07,380 --> 00:11:14,940
What this line is doing is telling the notebook that we are going to write JavaScript following this

125
00:11:14,940 --> 00:11:15,540
line.

126
00:11:15,690 --> 00:11:23,460
So we can write a JavaScript in the notebooks is not their usual way.

127
00:11:23,640 --> 00:11:26,790
A use the usual place.

128
00:11:27,000 --> 00:11:36,360
Usually you will find a JavaScript, as we will say, you know a later in console, you know browser,

129
00:11:36,360 --> 00:11:38,970
console or code editors, whatever.

130
00:11:38,970 --> 00:11:42,660
But here we are using a small trick.

131
00:11:42,660 --> 00:11:51,090
You know, we cannot use the print a or the console log a keyword, but if we use Window.alert and we

132
00:11:51,090 --> 00:11:55,320
execute this cell, you will see that we have a window alert.

133
00:11:55,500 --> 00:12:00,450
We are printing this message here in the window alert okay.

134
00:12:00,450 --> 00:12:06,000
So just just for you to understand the way we are using these notebooks okay.

135
00:12:06,780 --> 00:12:11,970
So this is what we say here a about Python execution.

136
00:12:11,970 --> 00:12:19,200
So just to remind you that these notebooks are absolutely used to work with Python.

137
00:12:19,200 --> 00:12:26,730
So this is going to work every time you remember what you have to do is you, you go to the cell, you

138
00:12:27,030 --> 00:12:32,760
use shift and enter and you are going to execute this cell.

139
00:12:32,760 --> 00:12:33,510
Okay.

140
00:12:33,720 --> 00:12:43,080
A we are mostly going to use notebooks in many parts of this, uh, program, but in some other parts

141
00:12:43,080 --> 00:12:46,080
you will see us using code editors.

142
00:12:46,590 --> 00:12:55,080
Uh, in the case of JavaScript, we can use, uh, the notebook with this, with this trick, a but

143
00:12:55,080 --> 00:13:04,320
usually we will we will use a code editors or, uh, browsers the console in the browser if you are

144
00:13:04,320 --> 00:13:11,970
familiar, for example, with the Chrome browser, you know how you can, uh, open the developer,

145
00:13:11,970 --> 00:13:16,200
you know, uh, part of the of the Chrome browser, etc., etc..

146
00:13:16,200 --> 00:13:16,410
Right?

147
00:13:16,410 --> 00:13:20,880
So this is where usually the front end developers work.

148
00:13:21,330 --> 00:13:28,800
It is important to highlight also a couple of things regarding notebooks and Python and JavaScript.

149
00:13:29,040 --> 00:13:33,420
What you say here in this cell remains here.

150
00:13:33,720 --> 00:13:40,230
So if I want to print x in this cell, this notebook remembers that x is equal to four.

151
00:13:40,230 --> 00:13:47,310
But in the case of this other notebook that is not so, uh, clear.

152
00:13:47,310 --> 00:13:55,200
So if I open a cell with this expression JavaScript and I say x is equal to four, and here I ask about

153
00:13:55,200 --> 00:14:00,600
x is very probable that this cell do not know anything about this solar cell.

154
00:14:00,600 --> 00:14:03,150
So don't trust a JavaScript.

155
00:14:03,300 --> 00:14:06,270
The memory of the notebook with the JavaScript notebooks.

156
00:14:06,270 --> 00:14:08,430
Okay, it doesn't work.

157
00:14:08,430 --> 00:14:09,960
It doesn't always work.

158
00:14:09,960 --> 00:14:11,310
In some cases it does.

159
00:14:11,310 --> 00:14:15,120
But in some most of of them it is not going to work.

160
00:14:15,120 --> 00:14:20,640
We will see that in functions for example, it is going to work, but in some other in most other cases

161
00:14:20,640 --> 00:14:22,050
it will not work.

162
00:14:22,050 --> 00:14:27,450
So just a few notes about the execution and about the notebooks.

163
00:14:27,690 --> 00:14:30,390
Let's talk about data types.

164
00:14:31,400 --> 00:14:32,390
So.

165
00:14:33,650 --> 00:14:36,620
Here you have see that in this notebook.

166
00:14:36,620 --> 00:14:41,090
We are going to give you more details and you will have even more details.

167
00:14:41,090 --> 00:14:46,580
We will see the W3 Schools.com website where you have even more details.

168
00:14:46,580 --> 00:14:54,410
We will guide you through that website for, for you to, to, you know, make good use of your time.

169
00:14:54,410 --> 00:15:01,280
Because if you don't know what you are doing, you are going to waste a lot of time in sites like W3

170
00:15:01,280 --> 00:15:02,150
Schools.com.

171
00:15:02,150 --> 00:15:03,680
So we will help you with that.

172
00:15:03,800 --> 00:15:11,450
Let's talk a little bit about data types in Python and in JavaScript, especially about the data types

173
00:15:11,450 --> 00:15:15,530
that are going to be relevant for us as LM developers.

174
00:15:15,680 --> 00:15:18,890
So the the.

175
00:15:19,900 --> 00:15:28,750
In most cases the the the most frequent data types we are going to be using in Python and in in JavaScript

176
00:15:28,750 --> 00:15:31,390
when we are working with Elm applications.

177
00:15:31,720 --> 00:15:41,290
Uh, I mean, the most frequent and the most complex one are arrays and objects or uh, we call it in

178
00:15:41,290 --> 00:15:43,990
Python lists and dictionaries.

179
00:15:43,990 --> 00:15:44,590
Okay.

180
00:15:44,590 --> 00:15:53,560
So if we go to the notebook, the Python notebook, you will see that arrays or vectors are called lists

181
00:15:53,560 --> 00:15:54,280
in Python.

182
00:15:54,280 --> 00:16:00,430
So this is what sometimes is a little bit annoying about two languages.

183
00:16:00,640 --> 00:16:01,660
They are.

184
00:16:02,480 --> 00:16:11,000
Yeah, you seem mostly the same functionality and the same elements, but they use different names for

185
00:16:11,000 --> 00:16:11,870
the same things.

186
00:16:11,870 --> 00:16:18,950
So I mean, it's a little bit annoying, but once you know it, you understand that they are very similar.

187
00:16:18,980 --> 00:16:19,430
Okay.

188
00:16:19,430 --> 00:16:22,790
So don't be intimidated by the difference in names.

189
00:16:22,790 --> 00:16:30,200
So in Python we call lists what in JavaScript we call arrays okay.

190
00:16:30,620 --> 00:16:34,400
So here you have a list in Python.

191
00:16:34,910 --> 00:16:38,480
And you can use you know range of indexes.

192
00:16:38,480 --> 00:16:45,620
For example in order to print just, you know, the a part of the of the list, you know, in different

193
00:16:45,620 --> 00:16:51,770
in different ways you have here, you have also here listed a common operations with this data type

194
00:16:51,770 --> 00:16:53,330
in JavaScript.

195
00:16:53,870 --> 00:16:54,530
Okay.

196
00:16:54,890 --> 00:17:03,170
Here you have a we even don't talk about uh, arrays because they are very simple in JavaScript.

197
00:17:03,170 --> 00:17:07,940
So we go directly to objects in Python.

198
00:17:07,940 --> 00:17:13,730
What JavaScript calls objects are called dictionaries okay.

199
00:17:13,730 --> 00:17:23,119
So if we go here you will see that Python dictionaries are very similar to Json objects.

200
00:17:23,270 --> 00:17:28,580
So here you have an example of a dictionary in Python.

201
00:17:28,580 --> 00:17:33,950
And here you have an example of a JavaScript object.

202
00:17:33,950 --> 00:17:34,550
Okay.

203
00:17:34,550 --> 00:17:43,010
Very similar a little differences but very similar in concept okay.

204
00:17:43,700 --> 00:17:47,030
Python as we say here has a.

205
00:17:48,300 --> 00:17:48,630
Three.

206
00:17:49,380 --> 00:17:50,010
Excuse me.

207
00:17:50,010 --> 00:17:50,460
Wow.

208
00:17:51,420 --> 00:18:03,810
So Python has a peculiar data type called tuple, which original originally was, uh, an unchangeable

209
00:18:03,810 --> 00:18:04,830
list.

210
00:18:05,250 --> 00:18:13,590
Right now we have tricks to change tuples, but, well, we can understand that a tuple is an unchangeable

211
00:18:13,590 --> 00:18:23,520
list is a peculiar Python data type A is very similar to a list, but instead of using the typical,

212
00:18:23,520 --> 00:18:31,410
you know, a syntax with the list, we are going to use parentheses for the tuple.

213
00:18:31,410 --> 00:18:40,110
And in the case of the tuple, if you only have one element, you will still going uh to use the the

214
00:18:40,110 --> 00:18:41,340
comma at the end.

215
00:18:41,340 --> 00:18:42,090
Okay.

216
00:18:42,090 --> 00:18:51,660
So we are not going to make a lot of, uh, we are not going to see a lot of tuples in Elm application

217
00:18:51,660 --> 00:18:52,290
development.

218
00:18:52,290 --> 00:18:59,130
And the operations with them are not going to be very complex in the case we find we find them.

219
00:18:59,130 --> 00:18:59,610
Okay.

220
00:18:59,610 --> 00:19:05,790
So about data types mostly we have the same thing in Python and and JavaScript.

221
00:19:05,790 --> 00:19:09,780
In some cases we have different names for the same things okay.

222
00:19:09,780 --> 00:19:12,390
Of course you have many other data types.

223
00:19:12,390 --> 00:19:16,860
And you will you will see that in W3 Schools.com.

224
00:19:16,860 --> 00:19:25,770
But these are the more relevant comments we want to to to give you regarding data types and and LM uh

225
00:19:25,770 --> 00:19:28,560
app development with Python and JavaScript.

226
00:19:28,740 --> 00:19:30,630
What about functions?

227
00:19:31,980 --> 00:19:40,770
So in a Python and in JavaScript, functions are very similar as well.

228
00:19:40,770 --> 00:19:45,240
So in Python we declare a function with the keyword def.

229
00:19:46,140 --> 00:19:50,130
In JavaScript, we declare a function with the keyword function.

230
00:19:50,130 --> 00:19:54,960
Okay, so here you have a function declaration in Python def.

231
00:19:54,960 --> 00:19:59,700
My function with one parameter is going to print.

232
00:19:59,700 --> 00:20:00,270
Hello.

233
00:20:00,270 --> 00:20:01,290
The parameter.

234
00:20:01,290 --> 00:20:07,950
Here we are calling the function the my function okay with a string called argument.

235
00:20:07,950 --> 00:20:09,540
And this is what we print.

236
00:20:09,540 --> 00:20:10,560
Hello argument.

237
00:20:10,560 --> 00:20:18,120
As you know what do we include here in this parentheses is called parameter when we are defining the

238
00:20:18,120 --> 00:20:18,720
function.

239
00:20:18,720 --> 00:20:20,220
And it's called argument.

240
00:20:20,220 --> 00:20:28,170
Argument when we are calling the function is, is is a little bit confusing and a little bit annoying.

241
00:20:28,170 --> 00:20:33,540
And most people just change this call these arguments and these parameters.

242
00:20:33,540 --> 00:20:34,380
It doesn't matter.

243
00:20:34,380 --> 00:20:35,670
Don't worry about it okay?

244
00:20:35,670 --> 00:20:40,050
Just remember that parameters and arguments are mostly the same thing.

245
00:20:40,380 --> 00:20:42,570
It's just a different moment in time.

246
00:20:43,470 --> 00:20:47,550
With JavaScript functions are very similar.

247
00:20:47,550 --> 00:20:56,910
Instead of def, we are using the function keyword, and here we are using the mind function uh parameter

248
00:20:56,910 --> 00:21:00,300
and we are returning hello parameter.

249
00:21:00,300 --> 00:21:03,510
You see very very similar syntax.

250
00:21:03,510 --> 00:21:04,740
Very similar.

251
00:21:04,980 --> 00:21:06,630
Uh here we have the colon.

252
00:21:06,630 --> 00:21:11,880
Here we have a different way of expressing it but very very similar.

253
00:21:11,880 --> 00:21:13,350
Here we are using print.

254
00:21:13,350 --> 00:21:15,420
Here we are using return.

255
00:21:15,420 --> 00:21:20,490
And if we call this function you see that we don't need this trick.

256
00:21:20,490 --> 00:21:26,160
The JavaScript in uh the this line, we don't need it in the notebook.

257
00:21:26,160 --> 00:21:27,690
This is going to work.

258
00:21:27,690 --> 00:21:32,190
And in this cell we are going to remember with the content here.

259
00:21:32,190 --> 00:21:37,830
So this is one of the exceptions you will find in the notebooks with with JavaScript okay.

260
00:21:37,830 --> 00:21:46,920
So apart from the declaration of the function we have some peculiar things to know about Python functions

261
00:21:46,920 --> 00:21:48,330
and JavaScript functions.

262
00:21:48,330 --> 00:21:55,050
And these you are going to find these kind of things when you are working with LM app development.

263
00:21:55,050 --> 00:22:04,770
So the first thing is the arbitrary argument arguments and keyword arguments.

264
00:22:04,770 --> 00:22:12,450
So in this function declaration we are saying that there is only one parameter.

265
00:22:13,520 --> 00:22:17,780
What happens if we don't know how many parameters we are going to have?

266
00:22:18,380 --> 00:22:24,020
We can use the arbitrary arguments or arbitrary keyword arguments.

267
00:22:24,050 --> 00:22:26,900
This distinction is more or less the same.

268
00:22:26,900 --> 00:22:27,680
This.

269
00:22:28,130 --> 00:22:33,140
If you want to know the difference, just go to ChatGPT for your friend and ask about it.

270
00:22:33,140 --> 00:22:36,440
In one second you have the response more or less.

271
00:22:36,440 --> 00:22:37,700
It's the same thing.

272
00:22:37,700 --> 00:22:44,840
The what we are saying here is a we are creating a function called person and we don't know how many

273
00:22:44,840 --> 00:22:46,880
parameters are we going to use.

274
00:22:46,880 --> 00:22:58,460
So here what we say is okay a the function person is going to print a string ID data a and we are going

275
00:22:58,460 --> 00:23:02,000
to call the name of the individual, okay.

276
00:23:02,000 --> 00:23:09,470
And when we are calling this person function we are defining the individual arguments okay.

277
00:23:09,470 --> 00:23:10,970
So the name is going to be Julio.

278
00:23:11,000 --> 00:23:12,590
The last name is going to be Colomer.

279
00:23:12,590 --> 00:23:14,060
So if we.

280
00:23:15,060 --> 00:23:25,260
Call this person function with this argument is going to tell us I is going to print ID data and the

281
00:23:25,260 --> 00:23:29,730
individual name, which in this case is Julio I'd data Julio okay.

282
00:23:29,730 --> 00:23:31,800
So this.

283
00:23:32,900 --> 00:23:42,530
A arbitrary arguments are something you are going to see very frequently when you work with Elm up development,

284
00:23:42,530 --> 00:23:45,710
where you review, you know, the code of other developers.

285
00:23:45,710 --> 00:23:48,500
So it's important to to have in mind.

286
00:23:48,620 --> 00:23:54,140
Another thing you will probably find is lambda functions.

287
00:23:54,200 --> 00:24:00,860
In Python we call lambda functions, what in JavaScript we call arrow functions.

288
00:24:00,860 --> 00:24:03,020
They are very very similar okay.

289
00:24:03,020 --> 00:24:07,490
So what are lambda functions and arrow functions.

290
00:24:07,490 --> 00:24:10,730
They are like condensed uh functions.

291
00:24:10,730 --> 00:24:15,470
They are like a short way of writing functions.

292
00:24:15,470 --> 00:24:30,020
So if we want to um, excuse me, if we want to write this function with a lambda, uh, way, we can

293
00:24:30,020 --> 00:24:32,270
do it in this way.

294
00:24:32,270 --> 00:24:32,750
Okay.

295
00:24:32,750 --> 00:24:36,350
So we are assigning the variable x.

296
00:24:36,620 --> 00:24:40,580
We will have to call it my function just to be exactly like that.

297
00:24:40,580 --> 00:24:43,040
But let's call the function x okay.

298
00:24:43,070 --> 00:24:45,740
We are going to say x equals to lambda.

299
00:24:45,740 --> 00:24:49,160
And this is the parameter we are sending.

300
00:24:49,160 --> 00:24:51,710
And this is what we are returning.

301
00:24:51,710 --> 00:24:54,500
Hello my plus parameter okay.

302
00:24:54,500 --> 00:24:55,880
So if we print.

303
00:24:57,190 --> 00:25:00,460
X with an string called argument.

304
00:25:00,460 --> 00:25:02,920
We are going to print hello argument.

305
00:25:03,950 --> 00:25:05,150
Super simple.

306
00:25:05,390 --> 00:25:09,350
This is a way, like a way to write faster.

307
00:25:09,560 --> 00:25:12,110
Some developers love it.

308
00:25:12,110 --> 00:25:19,220
Okay, so some developers, if they can write one line instead of two lines, they love it.

309
00:25:19,220 --> 00:25:28,550
So the more expert or the more a veteran the developer is, the more you are going to see this kind

310
00:25:28,550 --> 00:25:30,890
of things, which is a little bit confusing.

311
00:25:30,890 --> 00:25:35,930
Sometimes you will see, but some developers, they love this way.

312
00:25:35,930 --> 00:25:41,480
In JavaScript there is a very similar approach which is called arrow functions.

313
00:25:41,480 --> 00:25:49,880
So here you have the way to write an arrow function like the lambda function we we just wrote.

314
00:25:49,880 --> 00:25:56,720
So we are defining the variable my arrow function equal to parameter.

315
00:25:57,740 --> 00:25:58,880
Arrow function.

316
00:25:59,300 --> 00:26:00,380
Hello parameter.

317
00:26:00,410 --> 00:26:07,880
This means okay, this variable is going to be a function with a parameter, which is going to return

318
00:26:07,880 --> 00:26:10,880
the string hello plus the parameter.

319
00:26:10,880 --> 00:26:17,840
If we call this function with a string called argument, we are going to print hello argument okay.

320
00:26:17,840 --> 00:26:21,260
Very very similar until here.

321
00:26:21,260 --> 00:26:24,350
You know this is not very complex.

322
00:26:25,240 --> 00:26:34,960
Lambda function can be a little bit more complex when they are used as anonymous functions inside another

323
00:26:34,960 --> 00:26:35,680
function.

324
00:26:35,800 --> 00:26:38,530
Okay, so you can see things like this.

325
00:26:38,890 --> 00:26:50,110
You can see a function like matchmaker that has a lambda function included in there in its definition.

326
00:26:50,110 --> 00:26:50,920
Okay.

327
00:26:51,100 --> 00:26:53,620
So what are we doing here.

328
00:26:53,620 --> 00:27:04,240
We are defining a function that we call matchmaker, which is going to um take two single persons and

329
00:27:04,510 --> 00:27:07,750
it's going to make them marry.

330
00:27:07,780 --> 00:27:08,140
Okay.

331
00:27:08,140 --> 00:27:10,150
Get married, get married.

332
00:27:10,150 --> 00:27:18,100
So if we use this matchmaker function with Robert Mitchum and Ava Gardner, we will have the result.

333
00:27:18,100 --> 00:27:20,920
Ava Gardner, marriage of Robert Mitchum.

334
00:27:20,950 --> 00:27:22,930
Okay, how do we do it?

335
00:27:22,960 --> 00:27:28,900
We are using a lambda function inside of the matchmaker function.

336
00:27:29,200 --> 00:27:32,470
It's a little bit cumbersome for the rookies.

337
00:27:32,470 --> 00:27:34,150
It is not very intuitive.

338
00:27:34,150 --> 00:27:35,920
It is not very simple.

339
00:27:35,920 --> 00:27:41,980
When you find something like this, remember about the definition of the lambda function.

340
00:27:41,980 --> 00:27:49,330
And if you get confused, just copy this and paste it in ChatGPT four.

341
00:27:49,330 --> 00:27:56,680
And as the GPT four okay, convert this in a traditional function or explain what it means.

342
00:27:56,680 --> 00:27:57,190
Okay?

343
00:27:57,190 --> 00:28:05,080
But remember that whenever you find this keyword lambda, this is the way in JavaScript you can do something

344
00:28:05,080 --> 00:28:05,860
similar.

345
00:28:05,860 --> 00:28:12,730
And here is the way you can use an arrow function as an anonymous function inside another.

346
00:28:13,000 --> 00:28:14,470
This is cumbersome.

347
00:28:14,470 --> 00:28:18,400
I find it confusing, but some developers, they love it.

348
00:28:18,400 --> 00:28:23,470
You know, the more they do it, the more they love it, the more the more they get used to it.

349
00:28:23,500 --> 00:28:24,190
Whatever.

350
00:28:24,190 --> 00:28:27,880
So you may find arrow functions and lambda functions.

351
00:28:27,880 --> 00:28:35,680
I'm particularly not a fan of them, but we you are you are going to find these kind of functions very

352
00:28:35,680 --> 00:28:44,620
often when you review and study the Elm applications code of other developers, okay, which is going

353
00:28:44,620 --> 00:28:45,940
to be very common for you.

354
00:28:45,940 --> 00:28:52,360
So keep this in mind regarding functions and important things to to remember about functions.

355
00:28:52,690 --> 00:28:56,380
What about classes and objects?

356
00:28:56,770 --> 00:29:02,740
First thing, Python is what we call an object oriented language.

357
00:29:03,250 --> 00:29:11,050
So almost everything in Python is an object and it has properties and methods.

358
00:29:11,050 --> 00:29:13,570
We will see what is a property and what is a method.

359
00:29:14,020 --> 00:29:15,820
Actually super simple.

360
00:29:17,100 --> 00:29:18,510
We will see it very, very soon.

361
00:29:18,510 --> 00:29:24,900
So in Python, everything, almost everything is an object is an object oriented language.

362
00:29:24,900 --> 00:29:32,490
And you will see that it's very useful to be familiar with, you know, the basics of classes and objects

363
00:29:32,730 --> 00:29:33,900
in JavaScript.

364
00:29:33,900 --> 00:29:41,850
We have seen that in the newer versions of JavaScript, JavaScript is more and more into classes and

365
00:29:41,850 --> 00:29:42,210
objects.

366
00:29:42,210 --> 00:29:48,150
So we will see that it has a lot of things that are very similar to what Python has.

367
00:29:48,150 --> 00:29:48,600
Okay.

368
00:29:48,600 --> 00:29:55,950
So first thing, how to well, what is a class for the ones that are new to the concept?

369
00:29:56,430 --> 00:30:00,450
A class is like a blueprint to create objects.

370
00:30:00,870 --> 00:30:04,860
This example is going to make it very easy to understand it to you.

371
00:30:04,860 --> 00:30:10,050
So here we are a defining the class dog.

372
00:30:11,200 --> 00:30:15,280
And here we are creating a dock with the name Fido.

373
00:30:15,310 --> 00:30:19,360
Okay, so this is like the blueprint of a dock.

374
00:30:19,360 --> 00:30:21,190
And this is one dog.

375
00:30:21,190 --> 00:30:26,590
So this one dog is an object and the blueprint is what we call a class.

376
00:30:26,710 --> 00:30:27,280
Okay.

377
00:30:27,280 --> 00:30:30,640
So here we are creating a class dog.

378
00:30:30,640 --> 00:30:36,760
And we are including a property of this class which is called species.

379
00:30:37,240 --> 00:30:43,780
So in this property of the class do we say species is going to is going to be dog.

380
00:30:43,780 --> 00:30:51,820
So if we create a new instance of this class which is going to be an object and we call Fido this new

381
00:30:51,820 --> 00:31:00,070
dog, and if we print Fido species, it will say, okay, the species property of Fido is dog.

382
00:31:00,160 --> 00:31:00,940
Okay.

383
00:31:01,120 --> 00:31:07,510
Very, very simple and very easy to understand if we go to JavaScript.

384
00:31:08,960 --> 00:31:10,580
As you see here.

385
00:31:10,910 --> 00:31:14,150
A we have the same keyword class.

386
00:31:14,150 --> 00:31:14,660
Okay.

387
00:31:14,660 --> 00:31:18,980
So here we are defining the class dog.

388
00:31:19,010 --> 00:31:21,710
In this case it's a little bit more complex.

389
00:31:21,710 --> 00:31:23,000
Let's see.

390
00:31:24,500 --> 00:31:32,840
Python, and you will see that the complexity of JavaScript is actually a clone of Python.

391
00:31:32,840 --> 00:31:41,900
So this thing we have done here, the class definition, can be done in a more sophisticated way in

392
00:31:41,900 --> 00:31:42,440
Python.

393
00:31:42,440 --> 00:31:42,770
Okay.

394
00:31:42,770 --> 00:31:50,450
So instead of doing just class dog species dog, we could have used some more complex, way more sophisticated,

395
00:31:50,450 --> 00:31:59,150
more like, uh, more like the veterans way, you know, so we can use the init function.

396
00:31:59,150 --> 00:31:59,510
Okay.

397
00:31:59,510 --> 00:32:11,720
So, so if we are defining here a class cat, we can use the init function in order to define the properties

398
00:32:11,720 --> 00:32:17,180
of the class cat in a more elegant, you know, sophisticated way.

399
00:32:17,180 --> 00:32:25,130
And instead of saying just a species equals to cat and age equals to whatever we are going to use the

400
00:32:25,130 --> 00:32:30,680
init function in order to define the properties.

401
00:32:30,680 --> 00:32:31,190
Okay.

402
00:32:31,190 --> 00:32:40,880
So this thing we are using here, the init function is what we call the constructor in the JavaScript

403
00:32:40,880 --> 00:32:41,720
functions.

404
00:32:41,720 --> 00:32:44,240
Okay, so we are doing the same thing here.

405
00:32:44,240 --> 00:32:53,270
We are defining the class dog and we are including a property called species with and the string dog.

406
00:32:53,300 --> 00:33:01,580
Okay, so if we create a new dog uh, this is an object we call this object Fido.

407
00:33:01,610 --> 00:33:05,390
We are using a keyword for the for the variable.

408
00:33:05,570 --> 00:33:07,880
And this is const for constant.

409
00:33:07,880 --> 00:33:08,420
Okay.

410
00:33:08,420 --> 00:33:11,210
So Fido is going to be our new dog.

411
00:33:11,210 --> 00:33:20,930
And if we, uh, print the species of Fido, we shift enter, let's say.

412
00:33:21,720 --> 00:33:25,200
Come here and say shift, enter.

413
00:33:25,440 --> 00:33:30,870
We are going to have the dog species print.

414
00:33:31,020 --> 00:33:31,800
Okay.

415
00:33:32,070 --> 00:33:33,120
So.

416
00:33:34,090 --> 00:33:34,990
Very easy.

417
00:33:34,990 --> 00:33:39,340
I mean, a little bit confusing these names, but very easy.

418
00:33:39,340 --> 00:33:41,170
The concepts that are behind.

419
00:33:41,170 --> 00:33:41,830
Okay.

420
00:33:41,830 --> 00:33:46,270
What about this other function call?

421
00:33:47,320 --> 00:33:48,010
Esther.

422
00:33:48,010 --> 00:33:52,660
Well, here you have, you know, the example of a cat class.

423
00:33:52,660 --> 00:33:57,910
And then we are creating a cat and we are printing the color of this cat.

424
00:33:57,910 --> 00:33:59,590
Very super easy.

425
00:34:00,250 --> 00:34:05,110
What about the str, a function in Python?

426
00:34:05,110 --> 00:34:14,230
Well, we use this whenever we want to represent and the object of a class as a string.

427
00:34:14,230 --> 00:34:23,170
So what we are doing here is in the class cat, we are including the str function in order to return

428
00:34:23,260 --> 00:34:27,400
a the name of the cat and the color of the cat.

429
00:34:27,400 --> 00:34:29,409
So this is the the function.

430
00:34:29,409 --> 00:34:40,120
It is returning a the name, the color and the species of the cat self refers to the this particular

431
00:34:40,120 --> 00:34:42,400
object instead of self.

432
00:34:42,400 --> 00:34:45,760
In JavaScript we use this.

433
00:34:45,760 --> 00:34:47,770
Okay, same things.

434
00:34:47,770 --> 00:34:59,020
So as you see, to learn to programming languages is even easier than to learn one uh, programming

435
00:34:59,020 --> 00:35:01,510
languages one programming language.

436
00:35:01,570 --> 00:35:10,240
A because if you study two of them at the same time, you can see the I mean, the similarities which

437
00:35:10,240 --> 00:35:16,060
are, which are enormous, uh, between two languages like Python and JavaScript.

438
00:35:16,060 --> 00:35:18,940
And also, you know, the differences and the different names.

439
00:35:18,940 --> 00:35:24,040
Sometimes the way to understand a concept in JavaScript is easier than in Python.

440
00:35:24,040 --> 00:35:25,300
Sometimes is the opposite.

441
00:35:25,300 --> 00:35:34,090
But, uh, I think to to learn these two languages at the same time makes even the learning process

442
00:35:34,090 --> 00:35:35,980
even more simple.

443
00:35:36,220 --> 00:35:38,320
So here you have it.

444
00:35:38,950 --> 00:35:46,600
Last thing we are going to see with, uh, objects and classes is the the keyword pass.

445
00:35:46,900 --> 00:35:54,790
So we cannot define a class in Python, uh, an empty class without anything.

446
00:35:54,790 --> 00:36:02,620
So if we want to define a class without anything, any property or method or whatever, we will use

447
00:36:02,620 --> 00:36:03,730
the keyword pass.

448
00:36:03,730 --> 00:36:08,950
We are going to see how to use this when we talk about inheritance later.

449
00:36:09,370 --> 00:36:11,350
So a.

450
00:36:13,080 --> 00:36:17,310
I think this is all about classes and objects by now.

451
00:36:17,310 --> 00:36:26,460
Just to, uh, say that regarding methods and properties with classes, uh, you don't have nothing

452
00:36:26,460 --> 00:36:29,100
peculiar in Python or in JavaScript.

453
00:36:29,100 --> 00:36:30,480
It's very easy.

454
00:36:30,480 --> 00:36:32,070
What is a property?

455
00:36:32,070 --> 00:36:33,630
We know it already.

456
00:36:33,720 --> 00:36:34,170
Okay.

457
00:36:34,170 --> 00:36:36,000
Species name, age, color.

458
00:36:36,000 --> 00:36:37,830
These are properties of the class.

459
00:36:37,830 --> 00:36:39,870
What are methods?

460
00:36:39,870 --> 00:36:43,290
The functions that are included in a class.

461
00:36:44,100 --> 00:36:51,600
A small difference between a Python and JavaScript, as you see here.

462
00:36:52,810 --> 00:36:56,020
The methods inside a class.

463
00:36:56,020 --> 00:36:59,710
In JavaScript, they don't have the keyword function.

464
00:36:59,830 --> 00:37:07,630
In Python we have the keyword def, but in JavaScript you don't need to use the keyword function inside

465
00:37:07,630 --> 00:37:08,620
of a class.

466
00:37:08,680 --> 00:37:09,370
Okay.

467
00:37:10,730 --> 00:37:11,630
More things.

468
00:37:11,630 --> 00:37:14,330
Inheritance first.

469
00:37:14,720 --> 00:37:18,080
What is inheritance?

470
00:37:20,650 --> 00:37:29,650
So when a class inherits all the methods and properties from another class, don't worry about definitions.

471
00:37:29,650 --> 00:37:31,870
Let's check the example.

472
00:37:31,870 --> 00:37:40,570
So here we are creating a class person and we are defining some properties and methods inside of this

473
00:37:40,570 --> 00:37:41,500
class.

474
00:37:41,500 --> 00:37:45,850
And then we will create the class student.

475
00:37:45,850 --> 00:37:54,400
And we say you know what, I want the students to have all the properties and methods of the persons.

476
00:37:54,400 --> 00:37:58,870
So just say class student, person.

477
00:37:58,870 --> 00:38:05,830
With this way we are inheriting everything from person and we don't need to enter anything in the in

478
00:38:05,830 --> 00:38:09,970
the class definition, we just use the keyword pass okay?

479
00:38:09,970 --> 00:38:14,680
It's like okay, you just inherit everything from person and that's all you need.

480
00:38:14,680 --> 00:38:19,120
If we want to add something original just for student, we can include it here.

481
00:38:19,120 --> 00:38:23,230
But with this we are just cloning person into student.

482
00:38:23,260 --> 00:38:23,920
Okay.

483
00:38:25,000 --> 00:38:28,660
So this is very similar in JavaScript.

484
00:38:28,660 --> 00:38:33,730
The only little difference is that you use the extends keyword.

485
00:38:33,730 --> 00:38:36,970
So class student extends person.

486
00:38:36,970 --> 00:38:43,480
You see here the JavaScript explanation is more clear than the Python one.

487
00:38:43,480 --> 00:38:51,730
So studying both languages you can understand the concept uh earlier okay faster.

488
00:38:51,850 --> 00:38:57,550
So another uh interesting things regarding modules.

489
00:38:57,550 --> 00:39:06,400
So the concept of module modularity is very important when we are developing applications.

490
00:39:06,460 --> 00:39:15,580
Uh, the purpose of modularity or separating our code in different modules is to be able to, uh, have

491
00:39:15,580 --> 00:39:24,280
more control or more order organization regarding your code, why, we could have all our application

492
00:39:24,280 --> 00:39:28,330
in just one file, everything in just one file.

493
00:39:28,330 --> 00:39:37,060
But sometimes that makes it difficult when you want to debug, you know, when you want to reorganize,

494
00:39:37,060 --> 00:39:38,380
when you want to change things.

495
00:39:38,380 --> 00:39:45,490
And especially it makes it difficult when you are working in teams and different parts of the team are

496
00:39:45,490 --> 00:39:47,680
working in different parts of the code.

497
00:39:47,680 --> 00:39:54,880
Because of that, we separate the code of one application in different parts, and we call each of these

498
00:39:54,880 --> 00:39:56,590
parts modules.

499
00:39:56,590 --> 00:40:03,670
So when we want to use these modules with other modules, we use the keyword import.

500
00:40:03,670 --> 00:40:12,400
So let's say for example that we our application is going to be like a body okay a body of a person

501
00:40:12,400 --> 00:40:15,880
with the arms, you know, the legs, the head, whatever.

502
00:40:15,880 --> 00:40:22,840
But instead of having all these elements in one file, we separate each of these elements in different

503
00:40:22,840 --> 00:40:23,290
modules.

504
00:40:23,290 --> 00:40:28,540
So we have the arm in one module, the head in other module the leg, etc..

505
00:40:28,540 --> 00:40:29,020
Right.

506
00:40:29,020 --> 00:40:36,070
So if we are working in the I don't know, the main file for example, and we want to bring the different

507
00:40:36,070 --> 00:40:42,160
parts of the body, we can say import the arm, import the leg, import the head.

508
00:40:42,160 --> 00:40:42,610
Okay.

509
00:40:42,610 --> 00:40:46,600
So we have uh our code in different modules.

510
00:40:46,600 --> 00:40:53,860
And with the use of the import keyword we can bring these modules to the file we are working in.

511
00:40:53,860 --> 00:40:56,110
And this is the same thing.

512
00:40:56,110 --> 00:40:59,800
Uh, the import keyword is the same in Python and in JavaScript.

513
00:41:00,010 --> 00:41:02,530
What about packages.

514
00:41:02,530 --> 00:41:05,890
So packages are or plugins.

515
00:41:05,890 --> 00:41:07,840
Sometimes they are called plugins.

516
00:41:08,080 --> 00:41:15,520
They are a pre-designed uh Python or JavaScript.

517
00:41:15,520 --> 00:41:15,880
Uh.

518
00:41:18,450 --> 00:41:23,640
Modules, or sometimes they are like small applications or whatever.

519
00:41:23,640 --> 00:41:28,680
This is a code that is already developed for us.

520
00:41:28,680 --> 00:41:38,310
So you will you will find this super useful because thousands of developers have developed code for

521
00:41:38,310 --> 00:41:40,230
you and you can reuse it.

522
00:41:40,230 --> 00:41:48,930
So let's say you want code for authenticate users or, you know, to do something special with a database

523
00:41:48,930 --> 00:41:50,040
or whatever.

524
00:41:50,610 --> 00:41:59,100
Probably there there is some someone, somewhere that has already had this problem and have has has

525
00:41:59,100 --> 00:42:06,180
solved it and has loaded, you know, this package in the Python repository or the JavaScript repository

526
00:42:06,180 --> 00:42:07,920
and you can reuse it.

527
00:42:07,920 --> 00:42:13,170
Sometimes you reuse it like that, or sometimes you reuse it and modify or whatever.

528
00:42:13,170 --> 00:42:13,590
Okay.

529
00:42:13,590 --> 00:42:21,390
So the way we find these packages in Python is going to pi p.org.

530
00:42:21,390 --> 00:42:25,290
And in JavaScript we go to npm js.com.

531
00:42:25,290 --> 00:42:33,150
And the way we install this packages and this is in terminal is pip install or npm install.

532
00:42:33,150 --> 00:42:39,660
This is the most frequent that we are going to use in our terminal pip install whatever.

533
00:42:39,660 --> 00:42:45,660
And this is something that we will use whenever we are working with Next.js.

534
00:42:45,660 --> 00:42:49,800
Vercel uh, about the front end of the application.

535
00:42:49,800 --> 00:42:55,020
But you see that the concept is exactly the same different words, but the same concept.

536
00:42:55,290 --> 00:42:57,150
What about debugging?

537
00:42:57,150 --> 00:42:59,670
Here we have, uh, some code about this.

538
00:42:59,670 --> 00:43:05,970
So with debugging, uh, we have many different tools and ways here.

539
00:43:05,970 --> 00:43:10,920
We have highlighted a couple of them that in our opinion are significant.

540
00:43:11,160 --> 00:43:23,250
First, uh, this way in Python try accept is a way to, uh, prepare yourself in order to print an

541
00:43:23,250 --> 00:43:26,460
error message if something goes wrong.

542
00:43:26,460 --> 00:43:30,990
So you can say, okay, what I want is to print this, uh, string.

543
00:43:30,990 --> 00:43:31,830
All good.

544
00:43:31,830 --> 00:43:41,220
But if you have if Python finds any problem trying to execute this command, I want Python to print

545
00:43:41,220 --> 00:43:43,470
this, uh, error message.

546
00:43:43,470 --> 00:43:43,920
Okay.

547
00:43:43,920 --> 00:43:47,340
So this try accept is interesting.

548
00:43:47,340 --> 00:43:55,230
And whenever you are working in a, like a dangerous, risky, problematic code, you use it, you know,

549
00:43:55,230 --> 00:44:02,910
in order to, to send you a message saying, hey, this has failed and pay attention in JavaScript.

550
00:44:02,910 --> 00:44:06,090
This is very, uh, similar.

551
00:44:06,090 --> 00:44:09,150
Instead of try accept we use try catch.

552
00:44:09,150 --> 00:44:09,570
Okay.

553
00:44:09,570 --> 00:44:15,420
So is this annoying thing, you know, of different words meaning the same.

554
00:44:15,420 --> 00:44:20,430
So this is what you are going to find very commonly when you are comparing different, uh, programming

555
00:44:20,430 --> 00:44:20,850
languages.

556
00:44:20,850 --> 00:44:26,070
So in the case of JavaScript we find try and catch okay.

557
00:44:26,070 --> 00:44:30,030
And you have the different syntax, you know, but the concept is the same.

558
00:44:31,380 --> 00:44:39,930
Another thing you are going to find is the race exception in, uh, in, uh, uh, Python.

559
00:44:39,930 --> 00:44:49,740
So here what we are saying is if the variable x is, uh, less than zero, you are going to print this

560
00:44:49,740 --> 00:44:50,880
error message.

561
00:44:50,880 --> 00:44:51,450
Okay.

562
00:44:52,140 --> 00:45:00,300
And here, since x is minus one the notebook is going to print the error message okay.

563
00:45:00,300 --> 00:45:02,250
So here you have the error message.

564
00:45:02,250 --> 00:45:05,520
Sorry no numbers below zero okay.

565
00:45:05,520 --> 00:45:10,320
Probably this is not a very explanatory way but okay.

566
00:45:10,320 --> 00:45:12,060
You you get the you get the point.

567
00:45:12,060 --> 00:45:18,870
In uh JavaScript we have the throw new error way of doing it.

568
00:45:18,870 --> 00:45:20,280
Same thing.

569
00:45:20,280 --> 00:45:23,820
Okay, so just a quick note.

570
00:45:23,820 --> 00:45:28,860
Usually in JavaScript we are going to use the browser's console in order to debug.

571
00:45:28,860 --> 00:45:31,290
But we are not front end developers.

572
00:45:31,290 --> 00:45:33,690
So usually we are not going here.

573
00:45:33,690 --> 00:45:34,800
So don't worry about it.

574
00:45:34,800 --> 00:45:37,650
Just you know, be aware of it, but don't worry.

575
00:45:39,130 --> 00:45:46,630
A other things that are relevant and we are almost finishing in this section.

576
00:45:46,630 --> 00:45:52,900
One thing is the a how to get user input in Python.

577
00:45:53,320 --> 00:45:55,180
So in Python we use.

578
00:45:55,970 --> 00:45:57,110
Let's go to Python.

579
00:45:57,770 --> 00:46:00,950
In Python we use the input keyword.

580
00:46:00,950 --> 00:46:07,940
So if we execute this okay we execute this cell with shift enter.

581
00:46:08,360 --> 00:46:13,790
This input here is going to be displayed like this.

582
00:46:13,790 --> 00:46:22,160
We are asking the user to enter the user name so we can say Mike enter.

583
00:46:22,160 --> 00:46:27,260
And then with this user name that right now is Mike.

584
00:46:27,260 --> 00:46:30,020
The Python is going to print.

585
00:46:30,020 --> 00:46:31,550
Your username is.

586
00:46:32,480 --> 00:46:33,770
The username you enter.

587
00:46:33,770 --> 00:46:34,580
Mike.

588
00:46:34,580 --> 00:46:40,490
Okay, in a house in JavaScript, this is not very common.

589
00:46:40,640 --> 00:46:47,780
Uh, because usually we are, you know, working in frontend, but we can do this with prompt.

590
00:46:47,810 --> 00:46:48,320
Okay.

591
00:46:48,320 --> 00:46:55,730
So if we come here shift enter you see enter username we can say Michael.

592
00:46:58,350 --> 00:46:59,310
Okay.

593
00:46:59,310 --> 00:47:03,600
And then the window alert tells us your user name is Michael.

594
00:47:03,780 --> 00:47:04,410
Okay.

595
00:47:06,830 --> 00:47:13,070
So last words a about Python and JavaScript.

596
00:47:13,070 --> 00:47:15,020
The important things for us.

597
00:47:16,300 --> 00:47:22,300
You are going to find, we are going to W3 Schools.com.

598
00:47:22,300 --> 00:47:27,550
And right now I will show you where to find the Python tutorial and the JavaScript tutorial.

599
00:47:27,550 --> 00:47:34,420
Apart from the things we have highlighted for you in this section, I would pay attention to some other

600
00:47:34,420 --> 00:47:35,170
things.

601
00:47:35,170 --> 00:47:44,560
In the case of Python, I would pay attention to how Python works with Json, how Python handles files,

602
00:47:44,560 --> 00:47:45,820
and a.

603
00:47:46,630 --> 00:47:53,980
It may be interesting for you to pay attention to some tutorials about other frameworks, other machine

604
00:47:53,980 --> 00:47:56,050
learning frameworks regarding Python.

605
00:47:56,050 --> 00:47:59,920
I will show you where to find that in W3 schools.

606
00:47:59,920 --> 00:48:07,810
And regarding JavaScript, I would pay attention to JavaScript with Json and also the asynchronous way

607
00:48:07,810 --> 00:48:08,950
of working with JavaScript.

608
00:48:08,950 --> 00:48:12,880
So let's take a look at that in W3.

609
00:48:12,880 --> 00:48:16,540
So in W3 you can find the Python tutorial.

610
00:48:16,540 --> 00:48:18,940
And as you know this is a free website.

611
00:48:18,940 --> 00:48:20,620
This is a free tutorial.

612
00:48:20,620 --> 00:48:28,390
But the problem with these websites is is or these courses is that if you come here and inform, you

613
00:48:28,390 --> 00:48:33,880
are going to waste a lot of time and you are going to learn a lot of things that are not going to be

614
00:48:33,880 --> 00:48:34,360
useful.

615
00:48:34,360 --> 00:48:35,440
So let's see.

616
00:48:35,470 --> 00:48:38,890
See here how many things you have with Python.

617
00:48:38,890 --> 00:48:40,660
This is crazy right?

618
00:48:40,660 --> 00:48:47,770
So that's why I think it's very important for you to be informed about what is relevant as an LM app

619
00:48:47,770 --> 00:48:48,310
developer.

620
00:48:48,310 --> 00:48:48,850
Okay.

621
00:48:48,850 --> 00:48:56,230
But here, as I was telling you, you can find more information about Python and Json, Python and file

622
00:48:56,230 --> 00:48:59,350
handling, and also a Python.

623
00:48:59,350 --> 00:49:06,010
Working with other modules or frameworks like pandas is going to be more relevant for you sometimes

624
00:49:06,010 --> 00:49:07,420
numpy etc..

625
00:49:07,420 --> 00:49:11,740
Django not important, but these other 3rd May be interesting in some cases.

626
00:49:11,740 --> 00:49:17,470
So here you have, you know, more detailed uh, tutorials about that with JavaScript.

627
00:49:17,470 --> 00:49:18,070
The same.

628
00:49:18,070 --> 00:49:20,620
You have a huge tutorial here.

629
00:49:21,160 --> 00:49:31,150
And apart from the things we have highlighted, uh, here you have a Json and here you have the asynchronous,

630
00:49:31,270 --> 00:49:34,570
uh, asynchronous ways.

631
00:49:35,110 --> 00:49:39,640
The asynchronous way of working in JavaScript is very simple.

632
00:49:39,640 --> 00:49:46,480
It has like a this scary name, but at the end of the day, what it is calling it is it is the meaning

633
00:49:46,480 --> 00:49:47,590
of this is like, okay.

634
00:49:47,590 --> 00:49:54,370
For example, in most cases you are going to use a synchronous, a asynchronous, uh, methodology when

635
00:49:54,370 --> 00:49:56,050
you are working with databases.

636
00:49:56,050 --> 00:50:04,420
So since the operations with databases are sometimes a little bit slow, we want to we want our application

637
00:50:04,420 --> 00:50:09,310
to keep working while it is doing things in the database.

638
00:50:09,310 --> 00:50:16,420
So instead of waiting for the database operations to finish we say, okay, while you are doing this,

639
00:50:16,420 --> 00:50:17,860
do other things.

640
00:50:17,860 --> 00:50:20,080
This is the asynchronous way of working.

641
00:50:20,260 --> 00:50:24,040
It's not complex, you know, it's very simple in in concept.

642
00:50:24,040 --> 00:50:24,640
Okay.

643
00:50:24,640 --> 00:50:31,690
So the important thing for you to know is that here you have, you know, a huge tutorial about Python.

644
00:50:31,690 --> 00:50:33,730
Very interesting is simple.

645
00:50:33,730 --> 00:50:35,770
You have a lot of exercises here.

646
00:50:35,770 --> 00:50:37,870
You know, you have a lot of examples.

647
00:50:37,870 --> 00:50:44,740
You have a practical playing frame, a playground, you know, to play around with, with Python and

648
00:50:44,740 --> 00:50:45,610
also with JavaScript.

649
00:50:45,610 --> 00:50:52,930
So come here, you know, just to learn to practice, etc. but remember, these are the important things

650
00:50:52,930 --> 00:50:57,400
you need to keep in mind when you are thinking about JavaScript and about Python.

651
00:50:57,400 --> 00:51:00,670
And remember, you don't have to memorize this.

652
00:51:00,670 --> 00:51:05,920
The important thing is to understand the concepts, to know where to come back.

653
00:51:05,920 --> 00:51:12,700
You know, whenever you find a question or a problem and remember you have your friend there ChatGPT

654
00:51:12,700 --> 00:51:21,220
for to ask whatever question about Python or JavaScript you may have or to ask, you know, write this

655
00:51:21,220 --> 00:51:25,120
piece of code for me in Python or in JavaScript or whatever.

656
00:51:25,150 --> 00:51:33,520
Okay, so I thought this was important, uh, for you, in order to save time, instead of going through

657
00:51:33,520 --> 00:51:40,900
all these tutorials and, and courses and books about JavaScript, Python, etc. to understand only

658
00:51:40,900 --> 00:51:50,140
what is important, what is relevant for you as LM app developer to understand about Python and JavaScript.

