1 00:00:00,390 --> 00:00:01,350 Instructor: Welcome back. 2 00:00:01,350 --> 00:00:03,510 This is a quick, optional video 3 00:00:03,510 --> 00:00:06,390 that, well, with something that you probably 4 00:00:06,390 --> 00:00:09,900 won't use, but I want you to just know that it's out there. 5 00:00:09,900 --> 00:00:12,630 And that is there's actually an extra data type 6 00:00:12,630 --> 00:00:14,190 that I didn't talk about. 7 00:00:14,190 --> 00:00:16,170 And it's called complex. 8 00:00:16,170 --> 00:00:18,270 And, as the name suggests, 9 00:00:18,270 --> 00:00:20,850 it's pretty complex. 10 00:00:20,850 --> 00:00:24,750 However, a complex number, again, 11 00:00:24,750 --> 00:00:28,050 is a number that is a third type. 12 00:00:28,050 --> 00:00:32,100 Instead of int and float, 13 00:00:32,100 --> 00:00:34,770 we also have this type for numbers. 14 00:00:34,770 --> 00:00:37,380 Now, the reason I'm not really teaching complex 15 00:00:37,380 --> 00:00:39,210 is that you'll only use this 16 00:00:39,210 --> 00:00:42,960 if you're doing something really, really complex math. 17 00:00:42,960 --> 00:00:45,060 Most of the time, you'll never use it. 18 00:00:45,060 --> 00:00:47,100 I personally have never used it. 19 00:00:47,100 --> 00:00:48,780 But it is good to know 20 00:00:48,780 --> 00:00:50,670 that it exists. 21 00:00:50,670 --> 00:00:53,070 It's the equivalent to a real number 22 00:00:53,070 --> 00:00:56,460 and you can read about complex numbers if you want. 23 00:00:56,460 --> 00:00:59,340 But again, that's something that you don't need to worry 24 00:00:59,340 --> 00:01:02,100 99.9% of the time. 25 00:01:02,100 --> 00:01:03,660 Another thing I wanna talk to you about 26 00:01:03,660 --> 00:01:07,530 is this idea that these integers and floats 27 00:01:07,530 --> 00:01:12,330 get stored, such as five, in memory as binary. 28 00:01:12,330 --> 00:01:15,570 That is, as binary numbers, ones and zeroes. 29 00:01:15,570 --> 00:01:18,120 And there's actually an action or a function 30 00:01:18,120 --> 00:01:22,320 that we can use in Python called bin for binary. 31 00:01:22,320 --> 00:01:23,820 And you can see that a bin 32 00:01:23,820 --> 00:01:27,300 returns the binary representation of an integer. 33 00:01:27,300 --> 00:01:30,090 So it's going to return whatever the binary version 34 00:01:30,090 --> 00:01:31,590 of five is. 35 00:01:31,590 --> 00:01:36,090 If I click run here, well, I have to print. 36 00:01:36,090 --> 00:01:36,960 Remember. 37 00:01:36,960 --> 00:01:38,290 So let's print 38 00:01:40,290 --> 00:01:41,410 and click run 39 00:01:42,960 --> 00:01:45,900 and I get the binary representation. 40 00:01:45,900 --> 00:01:47,850 Now, instead of all zeroes and ones, 41 00:01:47,850 --> 00:01:50,430 there's also this idea of B. 42 00:01:50,430 --> 00:01:53,250 And that is what Python uses underneath the hood 43 00:01:53,250 --> 00:01:55,477 to say, "Hey, when I see this number 44 00:01:55,477 --> 00:01:58,620 "with zero B, that's a binary number." 45 00:01:58,620 --> 00:02:02,283 But if I google binary number 5, 46 00:02:04,380 --> 00:02:07,200 I see that the binary number for five 47 00:02:07,200 --> 00:02:12,200 is 101, which, again, that's what we see here. 48 00:02:13,650 --> 00:02:16,470 So, that's really cool, really interesting 49 00:02:16,470 --> 00:02:18,180 just to know that it exists. 50 00:02:18,180 --> 00:02:19,950 By the way, just for fun, 51 00:02:19,950 --> 00:02:23,190 let's say that we wanna return this into a decimal. 52 00:02:23,190 --> 00:02:24,747 Let's say we're the computer 53 00:02:24,747 --> 00:02:27,213 and we just retrieve this binary number. 54 00:02:28,140 --> 00:02:33,140 I can do int and then wrap this like this 55 00:02:33,810 --> 00:02:35,973 in single or double quotes. 56 00:02:36,840 --> 00:02:39,877 And then, with the int, I can also say, 57 00:02:39,877 --> 00:02:44,820 "Hey, I want this return to a number that is base 10," 58 00:02:44,820 --> 00:02:47,700 which is what us humans use. 59 00:02:47,700 --> 00:02:52,593 So if I actually do print here and click run, 60 00:02:54,960 --> 00:02:59,100 well, actually, we have to do base two here, right? 61 00:02:59,100 --> 00:03:00,937 Because what we're saying is, 62 00:03:00,937 --> 00:03:04,200 "Hey, this number is base two" 63 00:03:04,200 --> 00:03:06,150 and convert it to integer. 64 00:03:06,150 --> 00:03:08,790 And base two number is, well, zeroes and one. 65 00:03:08,790 --> 00:03:10,230 It's a binary number. 66 00:03:10,230 --> 00:03:11,673 So if I click run here, 67 00:03:13,020 --> 00:03:15,750 look at that, I get five. 68 00:03:15,750 --> 00:03:18,750 So in your head, you can think of it this way: 69 00:03:18,750 --> 00:03:20,550 when we store a number like five, 70 00:03:20,550 --> 00:03:24,030 an integer like five, when a computer retrieves that number, 71 00:03:24,030 --> 00:03:25,800 let's say we're doing some addition, 72 00:03:25,800 --> 00:03:29,580 well, it's going to grab this from memory. 73 00:03:29,580 --> 00:03:31,807 It's going to say, "Well, this is a binary number 74 00:03:31,807 --> 00:03:34,980 "and I'm going to convert it into integer." 75 00:03:34,980 --> 00:03:36,450 Very, very cool. 76 00:03:36,450 --> 00:03:38,820 Now, the reason I taught this here, 77 00:03:38,820 --> 00:03:41,700 you won't see this a lot in beginner courses 78 00:03:41,700 --> 00:03:43,980 and especially so early in the course, 79 00:03:43,980 --> 00:03:45,780 but I think it's an important principle, 80 00:03:45,780 --> 00:03:48,780 although you might not get tested on this, ever. 81 00:03:48,780 --> 00:03:51,480 For you to just understand how things are working 82 00:03:51,480 --> 00:03:54,180 underneath the hood, I believe is an important thing 83 00:03:54,180 --> 00:03:57,210 for you to do in order to become a great developer. 84 00:03:57,210 --> 00:04:00,120 So hopefully, this doesn't confuse you too much. 85 00:04:00,120 --> 00:04:02,120 I'll see you in the next video, bye bye.