Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,040 --> 00:00:05,390
In the last lectures, we talked about the basics of variables.
2
00:00:05,390 --> 00:00:06,830
What is the variable?
3
00:00:06,830 --> 00:00:11,120
What is the purpose of a variable and how to declare variables.
4
00:00:11,150 --> 00:00:15,950
Now we'll take a look at what type of data can be stored in a variable.
5
00:00:16,790 --> 00:00:24,740
Python is a dynamically typed programming language, and this is in contrast to C, C++, Java or GO,
6
00:00:24,740 --> 00:00:26,540
which are statically typed.
7
00:00:27,490 --> 00:00:29,980
A language is statically typed.
8
00:00:30,190 --> 00:00:36,100
If the type of a variable is known at compile time or before running the program.
9
00:00:38,120 --> 00:00:39,470
This is Java code.
10
00:00:39,590 --> 00:00:45,320
Before running this program, I know that the variable score is of typing.
11
00:00:47,070 --> 00:00:54,090
This means that the parameter must specify the type of data that will be stored in the variable when
12
00:00:54,090 --> 00:00:58,450
he defines the variable in a statically typed language like Java.
13
00:00:58,470 --> 00:01:05,580
A variable would be declared as an int score and then defined as score equals ten.
14
00:01:06,240 --> 00:01:07,620
I'm running the program.
15
00:01:11,250 --> 00:01:19,500
A language like Python is dynamically typed and it means that the type is associated with runtime values
16
00:01:19,500 --> 00:01:21,990
and not with named variables.
17
00:01:23,670 --> 00:01:31,470
So the values stored in variables have types and not the name or the variable itself.
18
00:01:31,590 --> 00:01:38,610
This means that you as a developer can write code a little bit quicker because you never have to specify
19
00:01:38,610 --> 00:01:39,690
variable types.
20
00:01:41,070 --> 00:01:47,190
In Python, we create a variable named score simply by writing a score equals ten.
21
00:01:49,480 --> 00:01:55,270
We can see what type of data a variable stores using the built in function type.
22
00:01:56,850 --> 00:01:59,550
Print type of score.
23
00:02:01,450 --> 00:02:04,630
For example, this is of typing.
24
00:02:05,700 --> 00:02:07,770
Each variable or object.
25
00:02:07,770 --> 00:02:16,470
A variable is in fact an object or an instance of a class has a type of value and an ID, and they are
26
00:02:16,470 --> 00:02:18,900
constant during the variable lifetime.
27
00:02:19,660 --> 00:02:30,230
I am declaring another variable A equals five and print type of A and then a equals python.
28
00:02:31,590 --> 00:02:33,720
And print type of a.
29
00:02:39,800 --> 00:02:44,360
A was of type in and then of type STR.
30
00:02:44,750 --> 00:02:51,350
In fact they are different variables or were saved at different addresses.
31
00:02:53,170 --> 00:02:56,710
Earlier, I said that the variable has a constant ID.
32
00:02:56,890 --> 00:02:59,890
What is that ID and how do we get it?
33
00:03:01,030 --> 00:03:08,950
The builtin function ID returns the memory address where the value referenced by the variable is stored
34
00:03:09,190 --> 00:03:10,510
or simply said.
35
00:03:10,510 --> 00:03:14,650
This is the address of the variable in memory.
36
00:03:21,290 --> 00:03:24,440
If I write, my var equals ten.
37
00:03:25,340 --> 00:03:34,820
Then my var is the reference to an integer object containing the value ten and is located at the memory
38
00:03:34,820 --> 00:03:37,220
address returned by the ID function.
39
00:03:44,120 --> 00:03:46,010
Now this is memory address.
40
00:03:46,730 --> 00:03:53,570
In conclusion, statically typed languages have better performance at runtime and are faster.
41
00:03:53,750 --> 00:04:02,030
This is because there is no need for type checking at runtime, but dynamically typed languages are
42
00:04:02,030 --> 00:04:06,770
comparatively faster during development time and are more flexible.
43
00:04:07,850 --> 00:04:08,570
Of exit.
44
00:04:08,660 --> 00:04:14,600
In this video, you will learn the differences between statically and dynamically typed programming
45
00:04:14,600 --> 00:04:18,290
languages, and that python is the dynamically typed one.
46
00:04:18,410 --> 00:04:21,769
Next, we'll move to built in data types.
47
00:04:22,430 --> 00:04:23,450
I'll see you soon.
4501
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.