Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,970 --> 00:00:01,930
Hey, guys.
2
00:00:01,930 --> 00:00:07,150
If you are coming from other programming languages, maybe you are wondering how to define a constant
3
00:00:07,150 --> 00:00:08,050
in Python.
4
00:00:08,470 --> 00:00:12,190
There are values in the real world that will never change.
5
00:00:13,040 --> 00:00:23,300
The mathematical constant pi with three decimal points will always be 3.1 42a day will always have 24
6
00:00:23,300 --> 00:00:32,990
hours, and the boiling point of water at sea level will always be 100 degrees Celsius or 212 degrees
7
00:00:32,990 --> 00:00:33,800
Fahrenheit.
8
00:00:34,160 --> 00:00:37,250
These values are known as constants.
9
00:00:37,880 --> 00:00:42,290
Python does not have anything in the language to declare a constant.
10
00:00:42,590 --> 00:00:49,640
A constant is declared like any other variable using x name, the equal sign and the value.
11
00:00:51,390 --> 00:00:58,380
In general, constant values are often written with uppercase letters to indicate that.
12
00:01:00,100 --> 00:01:02,470
Let's declare some constants.
13
00:01:02,560 --> 00:01:09,970
Pi equals 3.14 or six in our.
14
00:01:12,910 --> 00:01:15,970
Equals 3600.
15
00:01:18,060 --> 00:01:22,260
Or days in week equals seven.
16
00:01:22,890 --> 00:01:25,140
All of these are constants.
17
00:01:25,320 --> 00:01:31,710
I declared them as any other variable, but I used uppercase letters.
18
00:01:32,130 --> 00:01:36,330
Note that Python will not treat them in any special way.
19
00:01:36,780 --> 00:01:41,580
You can simply change them without any warnings or errors.
20
00:01:42,240 --> 00:01:47,880
For example, pi equals 3.142.
21
00:01:48,060 --> 00:01:49,100
The permitted.
22
00:01:49,110 --> 00:01:50,100
There is no error.
23
00:01:55,660 --> 00:01:56,380
The exit.
24
00:01:56,410 --> 00:02:01,250
In the next video, we'll talk about dynamic versus static typing.
25
00:02:01,270 --> 00:02:02,260
I'll see you soon.
2097
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.