1 00:00:11,230 --> 00:00:16,870 Hi, everybody, and welcome, this lecturer's topic will be integer and thought variables, which are 2 00:00:16,870 --> 00:00:18,160 numeric variables. 3 00:00:18,340 --> 00:00:22,360 In the last lecture we have cathode string variables and now we'll talk about numbers. 4 00:00:22,780 --> 00:00:25,270 So let's go over the definition. 5 00:00:25,510 --> 00:00:29,880 Python supports two types of numbers, integers and floating point numbers. 6 00:00:30,190 --> 00:00:34,120 So just a quick reminder, guys, we talked last last lecture. 7 00:00:34,120 --> 00:00:39,040 How can we identify integer sorry, string variables? 8 00:00:39,040 --> 00:00:40,900 How can we identify them? 9 00:00:41,260 --> 00:00:47,740 So we said that if we have a variable equals and then we have quotation marks before and after the value. 10 00:00:48,040 --> 00:00:50,090 So this will be a string variable. 11 00:00:50,520 --> 00:00:56,680 Now, as you can see, the numeric variables which are integer and float does not have quotation mark. 12 00:00:56,680 --> 00:01:03,490 And this is how we can def differentiate this integer and float variables from the string variable. 13 00:01:03,820 --> 00:01:06,120 So integers are whole numbers. 14 00:01:06,130 --> 00:01:06,520 All right. 15 00:01:06,890 --> 00:01:13,810 So when you see a variable and it equals to a whole number, you can identify this is an integer. 16 00:01:14,650 --> 00:01:21,870 And if we have, for example, Y equals 15, simply the value 15 will be stored inside the Y value. 17 00:01:22,450 --> 00:01:26,320 So and then we have the float variable, the float variable. 18 00:01:26,320 --> 00:01:29,590 We have an American value, whether that's a small portion. 19 00:01:29,800 --> 00:01:34,300 And this is how you can differentiate an integer from a float. 20 00:01:35,440 --> 00:01:41,110 So once you see that simple point, you can say that this and this variable is a float. 21 00:01:41,530 --> 00:01:45,100 So let's go quickly over a few examples. 22 00:01:45,580 --> 00:01:51,970 You can see here the variable age, which is equal to 52, and this is an integer. 23 00:01:55,070 --> 00:02:02,550 You can see here the wait, you have a decimal point, so this is a float here, also a whole number. 24 00:02:02,870 --> 00:02:10,010 So this is an integer and another one with the decimal point, the height. 25 00:02:10,040 --> 00:02:11,230 So this is a float. 26 00:02:11,990 --> 00:02:16,170 So now that we get the hang of it, let's go straight, straight to PI charm. 27 00:02:16,190 --> 00:02:18,620 Let's open it our initial project. 28 00:02:18,800 --> 00:02:23,450 And once it's all just right, click on it new and then create a new file. 29 00:02:25,300 --> 00:02:27,920 All right, sorry, Carlos, for me. 30 00:02:28,000 --> 00:02:28,430 All right. 31 00:02:28,450 --> 00:02:31,450 Let's call it integer. 32 00:02:34,020 --> 00:02:44,250 And float variables, let's give it the quick headline, Integer and Float. 33 00:02:45,840 --> 00:02:52,290 Variables, which are numbers I'm giving all of these comments, because if we encounter this fall further 34 00:02:52,290 --> 00:02:59,730 on like it from eight months from now or a few weeks from now, so we can get what the content immediately 35 00:02:59,730 --> 00:03:00,720 using these comments. 36 00:03:01,170 --> 00:03:03,960 So let's start quickly with the simple example. 37 00:03:03,960 --> 00:03:06,750 Print off a simple string. 38 00:03:09,080 --> 00:03:14,080 Variable, and let's just declare a new one. 39 00:03:17,880 --> 00:03:25,140 And let's give it the value 10 then, Brent, same as we did with strings, and that's put the variable 40 00:03:25,140 --> 00:03:25,620 inside. 41 00:03:27,170 --> 00:03:35,150 Right, click on the file run and there you have it, you have the variable value right here and now 42 00:03:35,150 --> 00:03:42,560 I'm going to do something and different before the variable here in the industry in their print. 43 00:03:42,560 --> 00:03:44,540 So let's add a string. 44 00:03:44,660 --> 00:03:54,020 Let's say integer variable value is two dots, then space. 45 00:03:54,290 --> 00:03:57,910 And then after the quotation mark, we want to add this variable to the print. 46 00:03:57,920 --> 00:04:01,580 Let's just add the plus side and that's printed. 47 00:04:02,090 --> 00:04:02,480 Right. 48 00:04:02,480 --> 00:04:04,030 Click, run. 49 00:04:05,210 --> 00:04:05,570 Whoa. 50 00:04:05,840 --> 00:04:06,260 All right. 51 00:04:06,270 --> 00:04:13,820 So we can see here in the console, I read the text, which indicates obviously we had an error up until 52 00:04:13,820 --> 00:04:14,260 this point. 53 00:04:14,270 --> 00:04:20,720 We didn't handle with exceptions or errors, but we will deeply for the further on in the exception 54 00:04:20,720 --> 00:04:21,650 handling part. 55 00:04:21,950 --> 00:04:23,880 But right now, let's do it the first time. 56 00:04:24,590 --> 00:04:28,370 So always when you have an error, you have indicative information in it. 57 00:04:28,370 --> 00:04:30,410 So try to read it to understand what happened. 58 00:04:30,740 --> 00:04:35,930 So we can see here the file, which is integer and float variables, which is our file. 59 00:04:36,080 --> 00:04:40,190 And we have an error error in line five, which is this line, the print one. 60 00:04:40,610 --> 00:04:51,490 And you can see here that we have can only concatenate string and not int to string meaning by charm 61 00:04:51,500 --> 00:04:55,550 is angry with us that we mixed string along with integer. 62 00:04:55,550 --> 00:05:00,450 He doesn't like it, so we need to solve it in order to remove this error. 63 00:05:00,680 --> 00:05:03,040 And how do we resolve this issue? 64 00:05:03,200 --> 00:05:11,120 We need to have one type of variable, one type of variable inside the print so we simply add brackets 65 00:05:11,150 --> 00:05:14,270 before and after the variable. 66 00:05:14,870 --> 00:05:22,190 And then we want after we have brackets around it that we want to add here, the letters s t r and you 67 00:05:22,190 --> 00:05:24,020 can see it turned purple for me. 68 00:05:24,050 --> 00:05:25,190 Maybe you have other calls. 69 00:05:25,190 --> 00:05:25,950 It doesn't matter. 70 00:05:27,110 --> 00:05:35,330 This means that we will convert this the of the integer variable into a string in order to have one 71 00:05:35,330 --> 00:05:37,390 type of variable inside the print. 72 00:05:37,790 --> 00:05:40,000 So let's try to run it right now again. 73 00:05:41,000 --> 00:05:41,780 There you have it. 74 00:05:41,790 --> 00:05:44,230 So integer variable value is ten. 75 00:05:44,540 --> 00:05:46,370 So problem resolved. 76 00:05:46,890 --> 00:05:47,270 All right. 77 00:05:47,280 --> 00:05:53,240 So let's give some more manipulations and math manipulations on integers and floats. 78 00:05:53,510 --> 00:05:59,480 And all along the way, I'm going to use the text and then string and then I'm going to put the number 79 00:05:59,480 --> 00:06:06,050 inside for one simple reason, because if I remove this text and then you will have here at 10 or 15 80 00:06:06,050 --> 00:06:15,620 values downwards, you will not know which one is or what, what manipulation we did upon the numbers 81 00:06:15,620 --> 00:06:16,340 you will see here. 82 00:06:16,580 --> 00:06:22,060 So when you have indicative text and then a number, you can know what the number had been through. 83 00:06:22,640 --> 00:06:24,710 So let's go on. 84 00:06:25,370 --> 00:06:35,690 So first of all, that's defined simple variables for further money. 85 00:06:37,180 --> 00:06:50,620 Two locations, so let's do a simple variable, A. And let's put it five, and then we have simple. 86 00:06:54,300 --> 00:07:01,290 Variable B equals then and let's start with the summary with the plus sign. 87 00:07:08,110 --> 00:07:13,420 And let's create a third variable, which will contain the summary of two of them summary. 88 00:07:18,550 --> 00:07:19,290 Result. 89 00:07:20,140 --> 00:07:25,060 And then that's put simple, by the way, I just want to remind you gathered that once you once you 90 00:07:25,060 --> 00:07:28,270 try typing, you have all of these options open here. 91 00:07:28,450 --> 00:07:34,750 And instead of typing the whole simple variable, a thing with your keyboard, you can just heat enter 92 00:07:34,750 --> 00:07:36,160 once selecting what you want. 93 00:07:37,720 --> 00:07:40,910 Plus simple variable be enter. 94 00:07:41,530 --> 00:07:41,920 All right. 95 00:07:41,930 --> 00:07:49,240 So in the last lecture when we talked about strings, so once we do the plus sign, we just try to printed. 96 00:07:49,510 --> 00:07:56,110 What we had seen is that you get the string first string and then the second string printed one after 97 00:07:56,110 --> 00:07:56,710 the other. 98 00:07:56,860 --> 00:07:59,040 But now we're dealing with numbers. 99 00:07:59,050 --> 00:08:00,760 So this would not happen. 100 00:08:00,790 --> 00:08:06,060 Now the plus sign will do a mathematical action upon these numbers. 101 00:08:06,100 --> 00:08:08,560 So let's just try to print it. 102 00:08:12,430 --> 00:08:16,240 Some are into that then after that plus SDR. 103 00:08:18,550 --> 00:08:24,590 And brackets and some result, let's print it and see what happens. 104 00:08:25,540 --> 00:08:25,770 Great. 105 00:08:25,970 --> 00:08:29,590 So we have the summary of 10 plus five right here, which is 15. 106 00:08:29,600 --> 00:08:30,670 And that's amazing. 107 00:08:31,180 --> 00:08:33,550 So let's do another one. 108 00:08:33,580 --> 00:08:34,450 Let's do. 109 00:08:36,290 --> 00:08:37,250 Multiply. 110 00:08:39,430 --> 00:08:42,730 Two numbers and 111 00:08:45,130 --> 00:08:51,640 let's do it again, multiply result equals simple number A and then do the star. 112 00:08:53,220 --> 00:08:55,770 And then simple, no be. 113 00:08:58,240 --> 00:09:01,200 All right, then, let's try to print it. 114 00:09:08,340 --> 00:09:12,250 And to the plus, all right, and then multiply a result. 115 00:09:12,990 --> 00:09:24,180 And don't forget to convert it using brackets and SDR letters and before it and let's try to print it 116 00:09:24,750 --> 00:09:27,780 five times, then we get 50. 117 00:09:27,990 --> 00:09:29,760 So we get it right here. 118 00:09:30,690 --> 00:09:42,240 And now we need to do a division, divide two numbers and divide result. 119 00:09:43,780 --> 00:09:45,490 And let's do. 120 00:09:46,730 --> 00:09:52,970 Simple, not a simple variable, a then slash and then simple, not a variable B. 121 00:09:55,780 --> 00:10:02,500 Sorry, B, and then A, we want to divide five divided by ten, divided by five. 122 00:10:03,990 --> 00:10:05,720 Then be divided by a. 123 00:10:05,780 --> 00:10:15,350 All right, click, Ron, I, I disappointed sorry, my bad print enter 124 00:10:17,970 --> 00:10:18,870 divide. 125 00:10:21,340 --> 00:10:26,500 To devise a result, let's have the same pattern as the others. 126 00:10:27,920 --> 00:10:28,560 Right. 127 00:10:29,170 --> 00:10:30,600 Just added the results here. 128 00:10:30,610 --> 00:10:33,010 So we have results for all of them. 129 00:10:33,580 --> 00:10:40,530 And plus SDR and brackets and double click on it control. 130 00:10:40,600 --> 00:10:43,690 See the copy control to paste and. 131 00:10:43,690 --> 00:10:44,260 That's right. 132 00:10:44,260 --> 00:10:45,490 Click and run. 133 00:10:46,930 --> 00:10:47,210 Great. 134 00:10:47,260 --> 00:10:49,090 So ten divided by five. 135 00:10:49,090 --> 00:10:50,050 We have two. 136 00:10:50,740 --> 00:10:51,330 All right. 137 00:10:51,700 --> 00:10:53,920 So this answer is correct. 138 00:10:54,310 --> 00:11:00,340 And now let's try to do power two numbers. 139 00:11:01,120 --> 00:11:03,970 So power result. 140 00:11:05,110 --> 00:11:14,290 And once you want to do power, you need to do for example, let's take a simple variable A and do it 141 00:11:14,290 --> 00:11:16,720 power and two. 142 00:11:18,800 --> 00:11:20,780 And let's bring the result. 143 00:11:23,710 --> 00:11:31,090 So basically, when you do power plus ACR, Brackett's, same thing, you seeing the same thing all 144 00:11:31,090 --> 00:11:35,620 along, and once we try to print it, we'll see. 145 00:11:35,620 --> 00:11:36,400 Twenty five. 146 00:11:36,740 --> 00:11:44,200 For those of you who don't know what power is, power is, just want to do a quick point here. 147 00:11:44,200 --> 00:11:47,110 So power is basically this. 148 00:11:49,720 --> 00:11:50,440 All right. 149 00:11:53,550 --> 00:12:01,890 So this is what you get with power, you just write, uh, you just write two stars, two times a star, 150 00:12:02,190 --> 00:12:04,680 and then you have the power action applied. 151 00:12:06,450 --> 00:12:07,200 All right, great. 152 00:12:07,210 --> 00:12:15,720 So next one in line is a special one is modular and modular is something that you don't encounter in 153 00:12:15,960 --> 00:12:17,640 daily basis. 154 00:12:18,390 --> 00:12:24,270 And but still, we're going to try to teach it and try to learn it. 155 00:12:28,670 --> 00:12:29,210 Sorry. 156 00:12:31,200 --> 00:12:38,470 And basically what that means is when we take a variable, for example, the value of five, right, 157 00:12:38,520 --> 00:12:45,150 because simple variable is five and then you do the percentage sine and then you do two. 158 00:12:46,950 --> 00:12:55,050 Basically, when you take five and you divided by two, you get the whole number, which is two. 159 00:12:55,560 --> 00:12:59,700 But you have like a left left over, which is one. 160 00:13:00,070 --> 00:13:00,660 All right. 161 00:13:00,930 --> 00:13:06,630 Because it's not a whole number that you get when you divide five by two, we'll get to where the left 162 00:13:06,630 --> 00:13:07,220 of one. 163 00:13:07,380 --> 00:13:11,880 So modular would give you the left one, the one the. 164 00:13:12,030 --> 00:13:13,830 This is the purpose of modulo. 165 00:13:17,850 --> 00:13:27,460 And let's try to see SDR copy paste inside the SDR and let's run it. 166 00:13:28,860 --> 00:13:29,400 All right. 167 00:13:29,400 --> 00:13:30,690 So there you have it. 168 00:13:30,690 --> 00:13:32,190 You have the model result. 169 00:13:32,190 --> 00:13:42,210 And now let's try to all of these words, integer variables, and let's try now to use a flawed variable 170 00:13:42,210 --> 00:13:43,620 which has a decimal point. 171 00:13:50,110 --> 00:13:57,370 It's not to use each decimal point variable, which is float, and that's do that. 172 00:14:01,640 --> 00:14:13,670 Valuable, a stake, two point five, and that's IMO very will be, and that's put a zero 25 and let's 173 00:14:13,670 --> 00:14:18,590 try to submit a new one summary. 174 00:14:21,110 --> 00:14:21,770 ofThe. 175 00:14:23,950 --> 00:14:34,780 To that symbol of two floats, to be more exact, so that more variable A and then that's A more variable 176 00:14:34,780 --> 00:14:48,160 B and let's try to print it right here, a summary of two float variables and plus the I'm sorry, ETR 177 00:14:48,160 --> 00:14:49,270 and Samari. 178 00:14:50,410 --> 00:14:53,530 And it's right here, you can click it with your mouse as well. 179 00:14:55,150 --> 00:15:01,720 And let's run it so we have a plus here so we can get. 180 00:15:01,900 --> 00:15:08,470 We're going to get two point seventy five when summarizing this value along with this one. 181 00:15:09,010 --> 00:15:11,230 And let's do one last thing. 182 00:15:12,290 --> 00:15:12,850 All right. 183 00:15:13,060 --> 00:15:18,340 Up until this point, what we did is we took these two variables, all right. 184 00:15:18,340 --> 00:15:21,840 A and B, and we apply the actions upon them along the way. 185 00:15:22,180 --> 00:15:28,090 But you don't have to use variables like this and then to apply actions between the two variables. 186 00:15:28,390 --> 00:15:28,900 All right. 187 00:15:28,900 --> 00:15:34,450 You can also just take two numbers as well and apply actions upon them as well. 188 00:15:34,600 --> 00:15:36,040 It's the easier thing. 189 00:15:36,050 --> 00:15:38,110 So I'm just going to give you one example. 190 00:15:38,110 --> 00:15:43,600 It's the easier way and the harder thing is to apply actions upon the variables. 191 00:15:44,050 --> 00:15:46,180 Actually, it's pretty much the same. 192 00:15:46,180 --> 00:15:49,780 But I want you to see the whole all cases. 193 00:15:49,990 --> 00:15:53,870 So you become a ninja in numbers on Python. 194 00:15:53,980 --> 00:15:56,700 So right here you can see all mathematical actions. 195 00:15:56,710 --> 00:15:57,250 All right, guys. 196 00:15:57,260 --> 00:16:02,800 So it gives you great power once you start writing automation test cases and you'll need to use math 197 00:16:02,800 --> 00:16:03,870 inside your test case. 198 00:16:04,060 --> 00:16:09,280 This gives you great power, guys, because now you know how to use numbers, you know how to play numbers. 199 00:16:09,400 --> 00:16:16,180 And later on, you're going to create lots of variables using these numbers and passing the variable 200 00:16:16,180 --> 00:16:19,000 and then using it and applying math actions on them. 201 00:16:19,300 --> 00:16:21,360 And this is very, very useful stuff. 202 00:16:22,180 --> 00:16:31,390 So let's do like this apply, act, apply actions upon variable. 203 00:16:31,940 --> 00:16:36,130 It's not just actions, it's math actions upon the very well. 204 00:16:36,640 --> 00:16:40,540 And let's do, for example, uh. 205 00:16:43,210 --> 00:16:53,590 Actions on a variable and again, it's not actions just like that, it's math actions equals, for example, 206 00:16:53,590 --> 00:16:55,750 let's do four times five. 207 00:17:00,750 --> 00:17:11,490 And let's just try to print it and apply math actions on a variable and. 208 00:17:14,320 --> 00:17:22,240 SDR, that's Sculpey, this one, and open the brackets, put it inside and try to run it. 209 00:17:24,100 --> 00:17:29,410 All right, so you can do this option as well, you see, I just apply the actions straight ahead on 210 00:17:29,410 --> 00:17:37,780 a variable without using declaration of variable before applying actions as we did in all of these places. 211 00:17:38,110 --> 00:17:42,520 So right here, we just applied it straight ahead on a variable. 212 00:17:42,730 --> 00:17:47,500 And you could do it with all the math actions that you want. 213 00:17:48,010 --> 00:17:52,420 Let's try the plus sign and it's a nine. 214 00:17:52,660 --> 00:17:53,050 All right. 215 00:17:53,060 --> 00:17:54,970 So that's about it, guys. 216 00:17:55,000 --> 00:18:02,080 Now, you have domination of all math actions, both on integer and offloads, so you can use whole 217 00:18:02,080 --> 00:18:06,290 numbers and also use float numbers with decimal point. 218 00:18:06,640 --> 00:18:08,020 So this party's is over. 219 00:18:08,170 --> 00:18:15,280 And I urge you guys that to know that knowing actually knowing the stuff, knowing the material is not 220 00:18:15,280 --> 00:18:21,880 just understanding it, but please do the following lectures and practice it so it will get deep in 221 00:18:21,880 --> 00:18:22,520 your mind. 222 00:18:22,690 --> 00:18:27,970 So later on, when you know all the parts together, you'll start writing test cases and you'll be a 223 00:18:27,970 --> 00:18:29,740 professional, you'll be a true ninja. 224 00:18:30,130 --> 00:18:32,490 So please practice first. 225 00:18:32,540 --> 00:18:37,720 First of all, just read the instructions in the next lecture of the assignment. 226 00:18:37,960 --> 00:18:39,370 Try to solve it by yourself. 227 00:18:39,370 --> 00:18:45,790 And if you are not mentioning managing to solve it by yourself, then see the following after that lecture 228 00:18:45,790 --> 00:18:46,960 to see the resolution. 229 00:18:47,110 --> 00:18:49,960 And I'll show you the whole resolution of the practice. 230 00:18:50,380 --> 00:18:51,990 And that's about it, guys. 231 00:18:52,020 --> 00:18:53,110 So thank you. 232 00:18:53,110 --> 00:18:54,610 And see you in the next lecture.