1 00:00:02,120 --> 00:00:09,260 Let's talk about a important term when it comes to programming, and that is Operator Precedent's. 2 00:00:11,490 --> 00:00:12,550 Now, what does that mean? 3 00:00:13,110 --> 00:00:24,690 Again, we're using our knowledge from math class, it's the idea that if I do 20 plus three times four, 4 00:00:25,530 --> 00:00:29,590 it means that different operators have precedence over different ones. 5 00:00:30,570 --> 00:00:37,650 That is, we multiply this first equals to 12 and then 20 gets added to 12. 6 00:00:38,920 --> 00:00:43,840 Because the Python interpreter is going to follow a basic set of rules. 7 00:00:44,970 --> 00:00:48,180 For example, if I do 20 minus three here. 8 00:00:49,740 --> 00:00:51,380 And let's print this out. 9 00:00:56,390 --> 00:01:05,060 I get it because three times four gets evaluated first, which he goes to 12 and then subtracted from 10 00:01:05,060 --> 00:01:05,490 20. 11 00:01:06,200 --> 00:01:11,150 It's not that this goes first and then we multiply 17 by four. 12 00:01:12,120 --> 00:01:17,820 And this operator precedence shouldn't be new, right, if you've taken any sort of math class, you 13 00:01:17,820 --> 00:01:24,480 understand that this is how well math works and this works the same in all programming languages. 14 00:01:24,730 --> 00:01:26,880 So the order is this. 15 00:01:27,660 --> 00:01:29,870 First we follow the brackets. 16 00:01:30,180 --> 00:01:32,860 So whatever is wrapped in a bracket, we do first. 17 00:01:33,540 --> 00:01:43,200 The second is we do the power of so whatever is done in the power of will be after parentheses. 18 00:01:43,530 --> 00:01:47,310 For example, if I do parentheses here. 19 00:01:48,970 --> 00:01:56,720 And then to the power of, let's say two or let's do plus two to the power of two. 20 00:01:57,520 --> 00:02:05,500 Well, the first operation that will happen is twenty minus three because that's the first precedence. 21 00:02:06,040 --> 00:02:10,450 And then we do two to the power of two because that's the next president's. 22 00:02:12,320 --> 00:02:17,090 And then only after we do that, we add these two together, in fact, click run. 23 00:02:18,560 --> 00:02:23,930 I get twenty one, which again, makes sense, 17 plus for. 24 00:02:26,160 --> 00:02:32,460 After the power of we have the multiplication and division. 25 00:02:33,590 --> 00:02:38,750 And then finally, the last precedence is addition and subtraction. 26 00:02:40,000 --> 00:02:44,470 Now, this isn't going to be a math class, some people really love math. 27 00:02:44,500 --> 00:02:46,150 Some people really don't. 28 00:02:46,690 --> 00:02:52,420 But I want to just give you this basic understanding of operator precedence when you see it. 29 00:02:52,570 --> 00:02:55,350 We'll do some exercises here to get accustomed to it. 30 00:02:55,450 --> 00:02:59,260 But trust me, this is as Mathie as we're going to get in this course. 31 00:02:59,830 --> 00:03:06,010 The math part of the course is, well, just here, it's going to get a lot more interesting as we learn 32 00:03:06,010 --> 00:03:07,330 about different data types. 33 00:03:07,960 --> 00:03:08,890 I'll see you in the next one. 34 00:03:09,540 --> 00:03:09,700 Bye.