1 00:00:00,590 --> 00:00:08,930 Numbers are used quite often in programming to keep scoring games, represent data visualization, stored 2 00:00:08,930 --> 00:00:11,240 information in web applications and so on. 3 00:00:11,270 --> 00:00:18,020 So Python threads numbers in several different ways depending on how they are being used. 4 00:00:18,200 --> 00:00:24,620 Let's first look at how Python manages integers because they are the simplest to work with. 5 00:00:25,360 --> 00:00:25,630 Here. 6 00:00:25,630 --> 00:00:26,580 We will do it. 7 00:00:26,610 --> 00:00:28,590 This run again. 8 00:00:28,600 --> 00:00:30,130 Here now. 9 00:00:32,330 --> 00:00:35,570 Firstly, we will start with integers. 10 00:00:35,720 --> 00:00:37,760 Now let's change the color. 11 00:00:43,190 --> 00:00:44,330 Integers. 12 00:00:47,010 --> 00:00:49,620 So you can do math with integers, of course. 13 00:00:49,620 --> 00:00:51,060 Here now. 14 00:00:53,640 --> 00:01:03,750 For example, my integer or my value here, two plus three and print my value. 15 00:01:04,580 --> 00:01:05,140 I see here. 16 00:01:05,140 --> 00:01:06,430 Five two plus nine. 17 00:01:06,480 --> 00:01:07,330 Nine nine. 18 00:01:10,770 --> 00:01:11,580 Doesn't one. 19 00:01:12,480 --> 00:01:14,400 You can do subtraction. 20 00:01:16,710 --> 00:01:19,370 And it's 9.97 multiplication. 21 00:01:21,160 --> 00:01:22,120 And division. 22 00:01:24,620 --> 00:01:26,360 In terminal session. 23 00:01:26,360 --> 00:01:33,500 Python simply returns the results of the operation, and Python uses two multiple action symbols to 24 00:01:33,500 --> 00:01:35,600 represent exponents. 25 00:01:35,810 --> 00:01:39,050 So here this is exponent exponential here. 26 00:01:39,050 --> 00:01:41,630 As you can see here, there's a lot of numbers here. 27 00:01:42,630 --> 00:01:42,930 Go. 28 00:01:44,650 --> 00:01:48,160 You can see here, we can do this. 29 00:01:52,440 --> 00:01:54,140 The second one I show here. 30 00:01:54,140 --> 00:02:01,400 So Python supports the order of operations too, so you can use multiple operations in one expression. 31 00:02:01,400 --> 00:02:08,270 So you can also use parentheses to modify the order of operations so Python can evaluate your expression 32 00:02:08,270 --> 00:02:12,650 in the order you specify, for example, like this. 33 00:02:13,190 --> 00:02:19,790 Uh, two plus two plus nine, multiply by four. 34 00:02:21,040 --> 00:02:22,900 Here it's 44. 35 00:02:22,900 --> 00:02:29,740 And the spacing in these examples has no effect on how Python evaluates the expressions here. 36 00:02:34,230 --> 00:02:35,040 Like this. 37 00:02:35,550 --> 00:02:36,000 This will. 38 00:02:36,330 --> 00:02:39,240 But this has no effect on Python. 39 00:02:39,390 --> 00:02:47,040 But it simply helps you more more quickly spot operations that have priority in your reading throughout 40 00:02:47,070 --> 00:02:48,750 your code. 41 00:02:49,710 --> 00:02:53,310 And we also have lots. 42 00:03:06,140 --> 00:03:13,370 So Python calls any number with a decimal point a float. 43 00:03:13,730 --> 00:03:20,060 This term is used in most programming languages, and it refers to the fact that a decimal point can 44 00:03:20,060 --> 00:03:23,300 appear at any position in a number. 45 00:03:23,330 --> 00:03:28,430 Every programming language must be carefully designed to appropriately manage decimal numbers so numbers 46 00:03:28,430 --> 00:03:31,940 behave appropriately no matter where the decimal point appears. 47 00:03:31,970 --> 00:03:37,210 So for the most part, you can use floats without worrying about how they behave. 48 00:03:37,220 --> 00:03:44,450 Simply enter the number numbers you want to use and the python will most likely do what you expect. 49 00:03:44,720 --> 00:03:46,490 Like this here for example. 50 00:03:46,490 --> 00:03:49,700 0.1 multiply by or. 51 00:03:53,020 --> 00:03:57,800 0.9 here it's 1.0999. 52 00:03:58,060 --> 00:04:01,100 1.099. 53 00:04:01,180 --> 00:04:05,440 And we also have here sample. 54 00:04:06,540 --> 00:04:06,990 Do. 55 00:04:07,900 --> 00:04:12,340 1999 multiply by 0.1. 56 00:04:13,330 --> 00:04:15,810 And 9.9. 57 00:04:15,960 --> 00:04:22,200 However, be aware that you can sometimes get an arbitrary number of decimal places in your answer. 58 00:04:22,530 --> 00:04:30,540 For example, this 0.90.2 here plus 3.1. 59 00:04:31,020 --> 00:04:33,330 And as you can see here, we get this. 60 00:04:33,540 --> 00:04:38,910 So this happens in all languages and this is of little concern. 61 00:04:38,910 --> 00:04:46,560 So Python tries to find a way to represent the results as precisely as possible, which is sometimes 62 00:04:46,560 --> 00:04:51,120 difficult, even how computers have to represent numbers internally. 63 00:04:51,120 --> 00:04:56,880 So just ignore the extra decimal places for now so you will learn ways to deal with the extra places 64 00:04:56,880 --> 00:05:01,530 when you need to in the projects of Part two. 65 00:05:01,890 --> 00:05:09,240 And we also said so when you divide in two numbers, even if they are integers that result in a whole 66 00:05:09,240 --> 00:05:10,020 number. 67 00:05:10,020 --> 00:05:18,700 So you will always get the float here, for example, divide four by two and the 2.0. 68 00:05:18,700 --> 00:05:26,070 So if you mix an integer and a float in any other operation, you will get a float as well. 69 00:05:26,080 --> 00:05:33,670 Look, this oops here, one one plus 5.0. 70 00:05:33,670 --> 00:05:36,190 And as you can see, it's 6.0. 71 00:05:36,400 --> 00:05:41,740 So Python defaults to a float in any operation that use the flow. 72 00:05:41,740 --> 00:05:44,410 So even if the output is a whole number. 73 00:05:45,550 --> 00:05:52,210 We also have underscores in numbers, which you will learn in next lecture.