1 00:00:00,600 --> 00:00:01,680 Instructor: Welcome back. 2 00:00:01,680 --> 00:00:04,833 Let's continue our understanding of int and float. 3 00:00:05,700 --> 00:00:08,610 We talked about the idea of these two data types 4 00:00:08,610 --> 00:00:10,890 and how we can use operations on them 5 00:00:10,890 --> 00:00:13,740 that we're familiar with from math class. 6 00:00:13,740 --> 00:00:16,440 Plus a few ones that, maybe, we haven't seen before, 7 00:00:16,440 --> 00:00:19,440 such as modular or the double slash, 8 00:00:19,440 --> 00:00:22,353 or the double multiply for the power of. 9 00:00:23,340 --> 00:00:25,110 Now, this is really cool because 10 00:00:25,110 --> 00:00:27,630 we can get our computers to do, 11 00:00:27,630 --> 00:00:30,513 well, math for us like a calculator, right? 12 00:00:31,440 --> 00:00:33,990 But a programming language also provides for us 13 00:00:33,990 --> 00:00:37,320 different actions that we can perform. 14 00:00:37,320 --> 00:00:40,140 Now, besides these ones, 15 00:00:40,140 --> 00:00:44,100 we also learn that there's a type action that we can take. 16 00:00:44,100 --> 00:00:46,410 There's a print action that we can take, 17 00:00:46,410 --> 00:00:50,520 but there's also specific math type functions 18 00:00:50,520 --> 00:00:52,980 that in and float are able to use, 19 00:00:52,980 --> 00:00:54,723 that are built into Python. 20 00:00:56,610 --> 00:01:00,900 Now, these are called, well, math functions. 21 00:01:00,900 --> 00:01:03,690 And functions, something we'll talk about later on, 22 00:01:03,690 --> 00:01:06,903 are these actions that we've been talking about. 23 00:01:07,770 --> 00:01:09,810 Remember our diagram here? 24 00:01:09,810 --> 00:01:12,030 We're starting to learn about the data types 25 00:01:12,030 --> 00:01:15,180 and the actions that we can perform on them. 26 00:01:15,180 --> 00:01:17,640 Now, in most programming languages, 27 00:01:17,640 --> 00:01:20,460 these actions are called functions, 28 00:01:20,460 --> 00:01:22,290 and we have a whole section on them. 29 00:01:22,290 --> 00:01:26,880 But for now, there's some functions that we can use. 30 00:01:26,880 --> 00:01:28,740 So this is a print function. 31 00:01:28,740 --> 00:01:30,600 This is a type function. 32 00:01:30,600 --> 00:01:33,420 But there's specific math functions, 33 00:01:33,420 --> 00:01:35,193 such as round. 34 00:01:36,480 --> 00:01:39,150 And you see right away, when I type, 35 00:01:39,150 --> 00:01:41,400 Repl is a tool, like an ID, 36 00:01:41,400 --> 00:01:44,553 that hints and tells us what we can add. 37 00:01:45,420 --> 00:01:46,770 So it says, "Round," 38 00:01:46,770 --> 00:01:48,840 and, "give me a number," 39 00:01:48,840 --> 00:01:51,300 and, maybe, "a digit." 40 00:01:51,300 --> 00:01:53,340 But let's just worry about the first one for now. 41 00:01:53,340 --> 00:01:55,890 So round, if I do 3.1, 42 00:01:55,890 --> 00:01:57,693 and I round here, 43 00:01:59,130 --> 00:02:01,380 I get two. 44 00:02:01,380 --> 00:02:03,990 Hmm. Well, that's not right, right? 45 00:02:03,990 --> 00:02:06,630 That's actually the result from up here 46 00:02:06,630 --> 00:02:08,699 because we need to also tell it 47 00:02:08,699 --> 00:02:12,577 to perform with a function of print. 48 00:02:12,577 --> 00:02:15,030 "Hey, print to the screen 49 00:02:15,030 --> 00:02:16,920 whatever the result of this is." 50 00:02:16,920 --> 00:02:19,860 And just to make things easier to see, 51 00:02:19,860 --> 00:02:21,270 I'm going to comment this out. 52 00:02:21,270 --> 00:02:22,860 So I'm just selecting everything, 53 00:02:22,860 --> 00:02:24,720 and then pressing Command + /, 54 00:02:24,720 --> 00:02:27,360 or if you're on Windows, Control + /. 55 00:02:27,360 --> 00:02:32,100 If I click Run, I get three because 56 00:02:32,100 --> 00:02:34,830 I'm rounding down the number. 57 00:02:34,830 --> 00:02:37,770 So let's say if it was 3.9, 58 00:02:37,770 --> 00:02:38,603 I click, 59 00:02:39,540 --> 00:02:40,560 and I get four. 60 00:02:40,560 --> 00:02:42,543 Again, I'm rounding the number. 61 00:02:43,890 --> 00:02:47,790 Another math function that's built into Python is 62 00:02:47,790 --> 00:02:50,160 something called abs. 63 00:02:50,160 --> 00:02:53,730 And you see, right away, that I get abs here, 64 00:02:53,730 --> 00:02:58,473 and ABS returns the absolute value of the argument. 65 00:02:59,430 --> 00:03:01,950 And again, for those that aren't too familiar with math, 66 00:03:01,950 --> 00:03:03,630 an absolute value simply means, 67 00:03:03,630 --> 00:03:05,670 well, no negative numbers. 68 00:03:05,670 --> 00:03:10,670 So an absolute value of negative 20 is 20. 69 00:03:10,680 --> 00:03:13,590 And now, because we know about math functions, 70 00:03:13,590 --> 00:03:15,540 I can start Googling, right? 71 00:03:15,540 --> 00:03:18,030 I can say, "Hey, I'm a Python programmer, 72 00:03:18,030 --> 00:03:19,920 and I wanna learn about math functions." 73 00:03:19,920 --> 00:03:24,920 Well, I can go, Python 3 math functions, 74 00:03:26,550 --> 00:03:27,810 and look at that. 75 00:03:27,810 --> 00:03:31,170 Right away, Google tells me that 76 00:03:31,170 --> 00:03:33,600 there's a ton that we can use. 77 00:03:33,600 --> 00:03:35,640 You don't have to memorize all of these. 78 00:03:35,640 --> 00:03:36,480 As a matter of fact, 79 00:03:36,480 --> 00:03:40,230 some of these I've never ever used in my programming career. 80 00:03:40,230 --> 00:03:41,220 But it's good to know 81 00:03:41,220 --> 00:03:44,580 that they have these tools available to you. 82 00:03:44,580 --> 00:03:45,990 And as a programmer, 83 00:03:45,990 --> 00:03:48,240 this is something that you'll have to get used to. 84 00:03:48,240 --> 00:03:50,970 The idea that you won't actually memorize 85 00:03:50,970 --> 00:03:55,970 every single action that we can take for each data type 86 00:03:56,310 --> 00:04:00,150 because some of these are very rarely used. 87 00:04:00,150 --> 00:04:02,280 Some of them you'll never use in your career. 88 00:04:02,280 --> 00:04:04,440 The key is to understand how to Google them 89 00:04:04,440 --> 00:04:05,850 and how to find them. 90 00:04:05,850 --> 00:04:07,170 And throughout this course, 91 00:04:07,170 --> 00:04:08,820 I will show you the important ones 92 00:04:08,820 --> 00:04:11,463 that you're gonna see over and over and over. 93 00:04:12,360 --> 00:04:15,510 But as a way for you to develop as a programmer, 94 00:04:15,510 --> 00:04:16,920 at least you know that this is 95 00:04:16,920 --> 00:04:19,740 how you look for answers and find out that, 96 00:04:19,740 --> 00:04:22,170 hey, there's different math functions 97 00:04:22,170 --> 00:04:23,823 that we can use with numbers. 98 00:04:24,960 --> 00:04:26,130 Right, let's take a break 99 00:04:26,130 --> 00:04:28,320 and continue in the next video. 100 00:04:28,320 --> 00:04:29,153 Bye-bye.