1 00:00:00,419 --> 00:00:01,190 Okey 2 00:00:01,309 --> 00:00:01,960 dokey. 3 00:00:01,970 --> 00:00:07,840 It is now time for us to try to put together everything that we've learned so far 4 00:00:08,220 --> 00:00:10,439 to write a program. 5 00:00:11,279 --> 00:00:12,479 And the program 6 00:00:12,880 --> 00:00:15,689 we want is the one that will prompt the user 7 00:00:16,068 --> 00:00:19,049 to keep entering a positive number. 8 00:00:19,979 --> 00:00:24,229 Or else if they want to exit the program, they can simply type in the words or, 9 00:00:24,239 --> 00:00:26,610 or the word done to exit the program. 10 00:00:26,620 --> 00:00:27,260 OK? So 11 00:00:27,590 --> 00:00:30,469 basically by saying, hey, user, keep adding a positive number, 12 00:00:30,479 --> 00:00:32,000 keep on adding a number, keep on adding 13 00:00:32,119 --> 00:00:32,880 N number. 14 00:00:33,389 --> 00:00:36,840 Whenever you're ready to exit the program, just type in done right 15 00:00:37,349 --> 00:00:38,049 now 16 00:00:38,340 --> 00:00:42,919 as the user is typing in the numbers 2349 11, whatever it is, 17 00:00:43,159 --> 00:00:46,069 we want to add those numbers to a list. 18 00:00:46,080 --> 00:00:51,700 We want to be able to keep track of all the numbers that the user keeps on providing us. 19 00:00:51,709 --> 00:00:54,330 So we're gonna add those numbers to a list, 20 00:00:55,759 --> 00:00:57,490 but we also want the program 21 00:00:57,759 --> 00:00:58,529 to check 22 00:00:59,259 --> 00:01:02,569 the even numbers that the user has added 23 00:01:02,840 --> 00:01:06,639 and keep track of the very first even number 24 00:01:07,099 --> 00:01:08,279 that was provided 25 00:01:08,680 --> 00:01:12,519 so that we can print out and tell the user that, hey, 26 00:01:12,569 --> 00:01:14,940 this was the first even number that you added. 27 00:01:14,949 --> 00:01:17,120 And then we can indicate what that number was. 28 00:01:17,400 --> 00:01:18,360 Otherwise, 29 00:01:18,599 --> 00:01:22,779 if the user added only odd numbers, then we can just simply say, OK, 30 00:01:22,879 --> 00:01:25,269 no, even numbers were found in your list. 31 00:01:25,680 --> 00:01:26,360 Now, 32 00:01:27,139 --> 00:01:30,000 once the user has added several numbers and 33 00:01:30,010 --> 00:01:32,339 then finally decides to exit the program, 34 00:01:32,599 --> 00:01:36,190 we want the program to print out all the numbers that were added by the user. 35 00:01:36,199 --> 00:01:38,569 And if the user never even added a single number, 36 00:01:38,800 --> 00:01:41,440 just say no numbers were entered. 37 00:01:42,139 --> 00:01:42,959 OK? 38 00:01:43,449 --> 00:01:50,389 So let us tackle this step by step. First of all, we're going to want a list, right? 39 00:01:50,610 --> 00:01:53,010 Let's call that list numbers. OK? So 40 00:01:53,190 --> 00:01:57,779 we're gonna be adding all the numbers entered by the user. 41 00:01:57,790 --> 00:02:00,559 We're going to add them to this list called numbers. 42 00:02:00,800 --> 00:02:05,120 So obviously we're going to make use of the input function to, you know, prompt 43 00:02:05,599 --> 00:02:06,680 a user 44 00:02:07,550 --> 00:02:09,050 to add numbers, right? 45 00:02:10,110 --> 00:02:10,830 OK. 46 00:02:11,240 --> 00:02:15,770 And we're gonna have to create a while loop in this scenario because 47 00:02:16,270 --> 00:02:18,869 we want the user to keep on adding a number or 48 00:02:18,880 --> 00:02:23,199 providing a number until they choose to exit the program. 49 00:02:23,210 --> 00:02:23,669 So 50 00:02:23,919 --> 00:02:29,199 we can say, you know, while true and then the user keeps on adding a number. 51 00:02:29,610 --> 00:02:31,399 And then we want to check 52 00:02:32,330 --> 00:02:34,059 if the number 53 00:02:34,270 --> 00:02:36,770 that was provided by the user 54 00:02:37,600 --> 00:02:39,179 was actually 55 00:02:39,350 --> 00:02:41,600 an even number. OK? 56 00:02:41,610 --> 00:02:43,740 So we're going to also have some sort of like 57 00:02:43,750 --> 00:02:46,809 an el statement that will check if the number, 58 00:02:47,029 --> 00:02:48,259 if it's DVI 59 00:02:49,009 --> 00:02:54,009 by two, you know that equals zero, you know, then print the even number, 60 00:02:54,410 --> 00:02:56,979 you know, stuff like this, you know, otherwise just say 61 00:02:57,130 --> 00:02:58,500 no even numbers are found. 62 00:02:58,960 --> 00:02:59,899 But what else? 63 00:03:00,759 --> 00:03:05,399 Remember that we also want to keep on adding the numbers that the user has provided. 64 00:03:05,410 --> 00:03:09,470 We want to add them to the list called the number. So 65 00:03:09,690 --> 00:03:11,899 we are going to have to append 66 00:03:12,389 --> 00:03:16,259 the user input to numbers 67 00:03:17,550 --> 00:03:18,809 list, right? 68 00:03:18,979 --> 00:03:22,539 And we're gonna make use of a new function here called append. 69 00:03:22,729 --> 00:03:25,529 All right. Don't worry, I'll show you how that works. 70 00:03:26,240 --> 00:03:28,619 Uh What else do we need to keep track of? 71 00:03:28,820 --> 00:03:31,809 That's pretty much it at this point, right? So 72 00:03:32,440 --> 00:03:35,539 first of all, we create a list called numbers. 73 00:03:35,820 --> 00:03:38,509 And then we're gonna have to prompt the user to add the numbers, 74 00:03:38,690 --> 00:03:40,860 check to see if the numbers are even 75 00:03:41,380 --> 00:03:45,270 once the very first even number has been found, let the program keep track of that. 76 00:03:45,279 --> 00:03:47,860 And then at the end, print out what that even number was. 77 00:03:48,179 --> 00:03:52,789 And then of course, also at the end of the program, most user have to say to exit it, 78 00:03:52,800 --> 00:03:56,779 simply print out all the numbers that the user added. 79 00:03:56,929 --> 00:03:57,580 So 80 00:03:57,899 --> 00:04:00,979 let us do this. All right, I'm gonna move this away 81 00:04:01,669 --> 00:04:04,020 and let us begin. So first things first, 82 00:04:04,289 --> 00:04:08,479 let us create our empty list that will contain all the numbers of anybody user. 83 00:04:08,490 --> 00:04:10,199 So numbers equals 84 00:04:10,339 --> 00:04:11,770 and then T OK? So 85 00:04:12,529 --> 00:04:14,350 that's the first thing I'm going to do. Now 86 00:04:14,660 --> 00:04:16,910 let us prompt the user 87 00:04:17,079 --> 00:04:18,350 to add 88 00:04:18,690 --> 00:04:20,910 the number. So I'm gonna say while 89 00:04:21,760 --> 00:04:22,940 and now true 90 00:04:23,220 --> 00:04:23,970 colon. 91 00:04:25,260 --> 00:04:29,239 Now we w we wanna prompt the user to provide some numbers. 92 00:04:29,429 --> 00:04:33,799 However, we'll have to assign users input to a variable. So 93 00:04:34,450 --> 00:04:39,359 let's say user underscore input, this will represent whatever the user adds. 94 00:04:39,369 --> 00:04:40,910 The user input in here 95 00:04:41,230 --> 00:04:43,579 equals to input 96 00:04:44,350 --> 00:04:45,299 brackets. 97 00:04:46,160 --> 00:04:47,980 And now let us prompt 98 00:04:48,329 --> 00:04:49,140 the user 99 00:04:50,149 --> 00:04:53,019 to enter a positive 100 00:04:53,420 --> 00:04:54,160 number. 101 00:04:55,609 --> 00:04:56,989 ok? Or 102 00:04:57,329 --> 00:05:00,739 in brackets, they could also just type type 103 00:05:01,920 --> 00:05:02,450 a da 104 00:05:05,160 --> 00:05:06,019 to 105 00:05:07,059 --> 00:05:07,720 finish 106 00:05:09,459 --> 00:05:09,929 10. 107 00:05:12,559 --> 00:05:13,540 So far. So good, 108 00:05:14,450 --> 00:05:15,510 we've assigned 109 00:05:15,869 --> 00:05:18,109 numbers. We have the empty list right there. 110 00:05:18,119 --> 00:05:20,109 This will collect the numbers provided by the user. 111 00:05:20,369 --> 00:05:23,309 And now we've created our loop to prompt the user 112 00:05:23,320 --> 00:05:25,790 to keep on adding a positive number or type done 113 00:05:25,910 --> 00:05:28,549 if they decide to finish. So 114 00:05:28,989 --> 00:05:33,339 what we're gonna do right now is let us check to see if the user 115 00:05:33,549 --> 00:05:34,959 has actually 116 00:05:35,119 --> 00:05:37,750 typed the letters done or typed, done 117 00:05:38,220 --> 00:05:39,739 because because we don't want the program to keep 118 00:05:39,750 --> 00:05:41,820 on running if the user decides to type down. 119 00:05:41,829 --> 00:05:42,209 So 120 00:05:42,470 --> 00:05:43,790 I am going to say 121 00:05:44,779 --> 00:05:45,760 if 122 00:05:46,290 --> 00:05:47,220 user 123 00:05:48,649 --> 00:05:49,720 underscore 124 00:05:49,880 --> 00:05:50,959 input 125 00:05:51,510 --> 00:05:53,420 is equal to 126 00:05:53,920 --> 00:05:54,980 done, 127 00:05:55,450 --> 00:05:57,640 if these are actually types done, 128 00:05:57,799 --> 00:05:59,040 what are we going to do? 129 00:05:59,200 --> 00:06:02,429 You guess that we are going to break the loop? 130 00:06:03,899 --> 00:06:05,589 All right, let me add 131 00:06:06,760 --> 00:06:08,019 some space in here. 132 00:06:08,239 --> 00:06:08,779 OK? 133 00:06:10,369 --> 00:06:10,920 Alright. 134 00:06:11,130 --> 00:06:11,649 So 135 00:06:12,500 --> 00:06:13,779 we have checked to see 136 00:06:14,029 --> 00:06:14,390 if this 137 00:06:14,609 --> 00:06:15,880 has typed in done 138 00:06:17,079 --> 00:06:19,559 if they did break the loop. 139 00:06:19,829 --> 00:06:20,820 However, 140 00:06:21,019 --> 00:06:26,709 if they typed an actual positive number. What do we want the program to do? 141 00:06:26,790 --> 00:06:33,179 We want the program to add that number to the numbers list? 142 00:06:33,450 --> 00:06:34,179 OK. 143 00:06:34,440 --> 00:06:39,299 So how are we going to do this? We need something to represent 144 00:06:39,470 --> 00:06:43,899 the numbers that will be provided by the user. 145 00:06:44,230 --> 00:06:46,890 In this case right now, don't get it twisted the user input. 146 00:06:46,899 --> 00:06:49,290 The variable in here is simply 147 00:06:49,579 --> 00:06:50,929 representing 148 00:06:51,500 --> 00:06:55,100 the input in here, enter a positive number or type down to finish. 149 00:06:55,109 --> 00:06:56,670 That's what it's representing in here. 150 00:06:56,720 --> 00:07:01,230 The actual numbers themselves, we have to create a new variable for that. So 151 00:07:01,450 --> 00:07:03,410 for the variable in here, 152 00:07:03,880 --> 00:07:05,880 I am going to say no, 153 00:07:07,170 --> 00:07:08,470 OK. Num 154 00:07:08,839 --> 00:07:10,299 is going to be equal 155 00:07:11,489 --> 00:07:12,470 two 156 00:07:12,700 --> 00:07:14,540 int remember the integer 157 00:07:14,679 --> 00:07:17,279 function that will convert whatever the user types in. So 158 00:07:17,410 --> 00:07:19,549 it's not going to be in integer 159 00:07:19,809 --> 00:07:22,570 and now underscore input 160 00:07:23,200 --> 00:07:26,109 OK? So basically whatever the user types at 161 00:07:26,220 --> 00:07:29,250 this line right here where we say enter a positive number 162 00:07:29,410 --> 00:07:35,589 if the user types in 5.2 for example, OK, convert a 5.2 to an integer, 163 00:07:35,600 --> 00:07:41,809 which will now be five and then assign five to the variable called number num. 164 00:07:42,540 --> 00:07:50,480 Now the next step will be to add this number that user has added to the numbers list. 165 00:07:50,489 --> 00:07:51,920 And how do we do that? 166 00:07:52,279 --> 00:07:54,799 I'm going to type in numbers 167 00:07:55,459 --> 00:07:57,670 and now check this out dots are 168 00:07:58,040 --> 00:07:58,700 handed 169 00:07:59,470 --> 00:08:01,170 and now in brackets. 170 00:08:01,329 --> 00:08:02,880 And um 171 00:08:03,190 --> 00:08:04,890 so this right here, this 172 00:08:05,140 --> 00:08:06,480 is going to be the function 173 00:08:06,670 --> 00:08:13,369 that will now begin to add the numbers added by the user to the numbers list. 174 00:08:13,779 --> 00:08:17,989 Let's go over it one more time. So first of all, we have our empty list called numbers. 175 00:08:18,010 --> 00:08:20,130 Let's create the loop called while 176 00:08:20,769 --> 00:08:23,399 the prompt user to keep on adding a positive number. 177 00:08:23,649 --> 00:08:28,920 However, if they typed done, if the user input is equal to done, break the loop, 178 00:08:28,929 --> 00:08:30,420 no need to continue. 179 00:08:30,579 --> 00:08:33,539 But if the user actually added real numbers, 180 00:08:33,940 --> 00:08:40,849 assign those numbers to a variable called num num and now start to append 181 00:08:40,979 --> 00:08:44,809 that those numbers to the numbers list. 182 00:08:45,650 --> 00:08:46,960 So far. So good. 183 00:08:47,890 --> 00:08:49,650 What else do we want to do? 184 00:08:50,000 --> 00:08:54,400 We want to check to see if any even number 185 00:08:54,650 --> 00:08:55,890 is being added. 186 00:08:56,109 --> 00:08:56,780 So 187 00:08:57,000 --> 00:08:58,359 what are we going to do? 188 00:08:58,859 --> 00:09:01,109 We are going to create a for 189 00:09:01,880 --> 00:09:02,030 loop. 190 00:09:03,119 --> 00:09:03,849 OK? 191 00:09:04,309 --> 00:09:05,590 That loop 192 00:09:05,789 --> 00:09:10,150 is going to go through all the numbers in the numbers list 193 00:09:10,520 --> 00:09:14,960 and then find the very first even number. So check this out. 194 00:09:15,210 --> 00:09:17,090 I'm going to say four 195 00:09:18,049 --> 00:09:19,030 norm 196 00:09:19,440 --> 00:09:20,140 in, in 197 00:09:20,289 --> 00:09:21,049 what? 198 00:09:21,489 --> 00:09:25,270 In numbers? That's right. Now, let's add a colon. 199 00:09:26,469 --> 00:09:28,390 Let's create our if 200 00:09:28,520 --> 00:09:30,450 else statement. So if numb 201 00:09:31,809 --> 00:09:33,869 divided by two equals to zero, 202 00:09:34,070 --> 00:09:37,229 what do we want the program to say? We want the program to say print 203 00:09:38,299 --> 00:09:39,690 and now 204 00:09:40,080 --> 00:09:41,309 our brackets, 205 00:09:42,280 --> 00:09:44,659 let's add our F string. 206 00:09:45,099 --> 00:09:47,940 And then we can say uh found 207 00:09:48,960 --> 00:09:50,130 the first 208 00:09:51,210 --> 00:09:53,789 uh the first even number 209 00:09:54,750 --> 00:09:58,250 and then of course, uh curly braces 210 00:09:58,619 --> 00:10:00,330 and then numb. 211 00:10:02,039 --> 00:10:02,539 OK. 212 00:10:04,530 --> 00:10:05,690 Otherwise, 213 00:10:06,130 --> 00:10:10,369 if the number that was added by the user isn't even 214 00:10:10,520 --> 00:10:12,010 simply break, 215 00:10:12,549 --> 00:10:13,440 let's just break it. 216 00:10:13,580 --> 00:10:14,210 OK? 217 00:10:14,640 --> 00:10:18,169 And now we can add our L statement to do something and 218 00:10:18,400 --> 00:10:19,210 we can say 219 00:10:20,119 --> 00:10:21,659 colon and now 220 00:10:22,169 --> 00:10:23,369 we're going to say 221 00:10:24,179 --> 00:10:25,640 a print 222 00:10:29,130 --> 00:10:32,619 and I say no even numbers 223 00:10:34,039 --> 00:10:37,080 uh were entered 224 00:10:37,549 --> 00:10:39,539 by the user. 225 00:10:42,260 --> 00:10:44,000 And there it is. However, 226 00:10:44,109 --> 00:10:47,539 again, the identation is very, very important. Keep in mind that this 227 00:10:47,950 --> 00:10:51,340 is under the four, OK? So it's not, it's not, 228 00:10:51,450 --> 00:10:52,640 it's not if else 229 00:10:53,679 --> 00:10:54,799 is the four Ls 230 00:10:55,039 --> 00:10:56,530 are statement in here. So 231 00:10:57,020 --> 00:10:57,979 just make sure 232 00:10:59,690 --> 00:11:00,679 that you don't make the mistake. 233 00:11:00,690 --> 00:11:03,580 The identation are gonna be very, very, very, very, very important. So 234 00:11:03,940 --> 00:11:07,280 it's basically four and then number in numbers, if nor 235 00:11:07,570 --> 00:11:09,280 divided by two equals zero points, 236 00:11:09,440 --> 00:11:12,270 we find the very first number and then print out what the number is. 237 00:11:12,359 --> 00:11:17,489 Otherwise simply break the loop once that number has been found, 238 00:11:17,500 --> 00:11:19,469 once the very first positive number has been found. 239 00:11:19,659 --> 00:11:21,440 So the first even number has been found 240 00:11:21,799 --> 00:11:24,849 and then if no even number was added by the user at all, 241 00:11:25,020 --> 00:11:29,419 they just simply print out no even numbers were entered by the user. 242 00:11:29,770 --> 00:11:30,530 OK? 243 00:11:30,859 --> 00:11:35,380 Last, but not least we now have to print out all the numbers 244 00:11:35,640 --> 00:11:40,219 the user has added at the end of the program. So 245 00:11:41,260 --> 00:11:42,599 I'm gonna come out here right now, 246 00:11:43,039 --> 00:11:45,359 add the new if statement 247 00:11:45,750 --> 00:11:52,679 and simply say if number. So if the user actually added some numbers, so if numbers, 248 00:11:52,869 --> 00:11:55,309 guess what? Simply print. 249 00:11:56,000 --> 00:11:58,020 And now I'm gonna say F 250 00:11:59,000 --> 00:12:00,429 and now in codes, 251 00:12:00,830 --> 00:12:01,559 the 252 00:12:02,590 --> 00:12:03,530 numbers 253 00:12:05,520 --> 00:12:06,669 you entered 254 00:12:08,669 --> 00:12:09,369 and then 255 00:12:10,239 --> 00:12:11,880 curly braces. 256 00:12:12,599 --> 00:12:13,270 Now, 257 00:12:13,659 --> 00:12:14,530 numbers 258 00:12:16,260 --> 00:12:17,590 otherwise. 259 00:12:17,880 --> 00:12:19,599 So that's going to be 260 00:12:22,489 --> 00:12:25,559 simply prints. That is if the user did not add any numbers, 261 00:12:25,719 --> 00:12:26,590 but you just say 262 00:12:26,909 --> 00:12:30,549 no numbers were entered by the user. 263 00:12:33,869 --> 00:12:34,820 Let us try. 264 00:12:36,369 --> 00:12:37,789 I'm gonna go ahead right now. 265 00:12:38,380 --> 00:12:39,510 We're on the program 266 00:12:40,739 --> 00:12:46,900 and 0000, so we do have a bit of an issue right here. It says line 23. 267 00:12:47,109 --> 00:12:50,280 OK. Print f what did I do wrong in here? 268 00:12:50,940 --> 00:12:52,840 Oh, there shouldn't be any space. Sorry, 269 00:12:53,260 --> 00:12:55,760 there shouldn't be any space right there. 270 00:12:56,090 --> 00:12:58,369 You see how just a single space can ruin everything. 271 00:12:58,380 --> 00:13:00,070 It's, it's kind of infuriating but yeah, 272 00:13:00,320 --> 00:13:01,520 so whenever using the F strings, 273 00:13:01,530 --> 00:13:04,239 make sure there's no space between the F and your code. 274 00:13:04,250 --> 00:13:06,400 So let's try that again, run. 275 00:13:06,590 --> 00:13:07,640 OK? So 276 00:13:08,359 --> 00:13:09,739 I'm going to add one. 277 00:13:10,849 --> 00:13:13,070 All right. Let's add three. 278 00:13:13,739 --> 00:13:15,119 Let's add four. 279 00:13:15,239 --> 00:13:17,400 OK. Let's add five. 280 00:13:18,070 --> 00:13:19,590 Let's add eight, 281 00:13:19,830 --> 00:13:21,280 let's add six. 282 00:13:21,549 --> 00:13:23,530 And now I'm going to type in done 283 00:13:23,700 --> 00:13:24,479 enter 284 00:13:24,979 --> 00:13:25,849 and there you go. 285 00:13:26,330 --> 00:13:28,650 The first number first, even number was four. 286 00:13:28,919 --> 00:13:33,750 And now we've typed in the other numbers which are 13458 and six. 287 00:13:33,979 --> 00:13:35,130 So you can see right now 288 00:13:35,440 --> 00:13:38,130 the program actually works. 289 00:13:38,950 --> 00:13:44,409 So let me run through the program one more time. First of all, 290 00:13:45,239 --> 00:13:46,309 we created 291 00:13:47,169 --> 00:13:49,409 a list called numbers. 292 00:13:49,799 --> 00:13:51,229 This will hold 293 00:13:51,530 --> 00:13:54,469 every single positive number added by the user. 294 00:13:55,250 --> 00:13:57,989 Next, we created the while 295 00:13:58,150 --> 00:13:58,750 loop 296 00:13:59,159 --> 00:14:04,830 that will continually prompt the user to keep on adding a positive number or 297 00:14:05,090 --> 00:14:06,590 if they choose not to, 298 00:14:06,599 --> 00:14:10,840 they can simply type in the words or the word done to finish the program. 299 00:14:10,969 --> 00:14:15,510 So we now need to check if the user actually typed in, done. 300 00:14:16,030 --> 00:14:17,650 And by the way, let me even try that. 301 00:14:17,659 --> 00:14:20,849 OK, let's run and let's just type in done instantly and see. 302 00:14:21,479 --> 00:14:22,309 Well, there you go. 303 00:14:22,859 --> 00:14:24,340 So the program works very, very well. 304 00:14:24,349 --> 00:14:28,539 So it actually checked to see, hey, did this user type in done? Oh, it did. OK. 305 00:14:28,549 --> 00:14:30,359 So if we typed in done, 306 00:14:30,599 --> 00:14:31,640 then simply 307 00:14:31,789 --> 00:14:34,239 break the loop, 308 00:14:34,419 --> 00:14:38,010 we don't need to run the loop any longer because the user has typed in done. 309 00:14:38,229 --> 00:14:38,799 So 310 00:14:39,640 --> 00:14:43,380 in that case, right now, in this scenario where the user has typed in done, 311 00:14:43,739 --> 00:14:46,229 basically all of this, 312 00:14:47,299 --> 00:14:49,130 all of this stuff right here 313 00:14:49,950 --> 00:14:51,929 is completely irrelevant. 314 00:14:52,059 --> 00:14:52,609 OK? 315 00:14:52,969 --> 00:14:55,239 The Python program will go straight from this, 316 00:14:55,250 --> 00:14:57,929 from the break statement all the way down here 317 00:14:58,159 --> 00:14:59,500 to simply saying, hey, 318 00:14:59,780 --> 00:15:01,809 uh first of all, all, all the way right here. 319 00:15:01,820 --> 00:15:05,650 So first of all say, hey, no, even numbers we were entered by the user 320 00:15:05,849 --> 00:15:06,929 and then finally, 321 00:15:07,219 --> 00:15:11,000 no numbers were added by the user. So all this 322 00:15:11,109 --> 00:15:15,169 normal calls integer, if not uh is gonna skip all of that. 323 00:15:15,890 --> 00:15:19,010 But what if the user actually typed in 324 00:15:19,609 --> 00:15:20,460 a number? 325 00:15:21,369 --> 00:15:23,619 What do we want the program to do. Well, 326 00:15:24,039 --> 00:15:28,070 we want to add that number to our numbers list. 327 00:15:28,179 --> 00:15:31,979 So we need to assign the user input to a variable. 328 00:15:32,000 --> 00:15:34,549 In this case right now, we created a variable called norm 329 00:15:34,650 --> 00:15:37,580 that will represent the input provided by the user. 330 00:15:37,770 --> 00:15:42,450 And we also added the int in fact, let's try this and see. 331 00:15:43,190 --> 00:15:45,280 I'm gonna say 4.5 332 00:15:45,950 --> 00:15:46,609 enter 333 00:15:47,020 --> 00:15:50,369 and 0000 OK. 334 00:15:50,729 --> 00:15:55,340 There is a bit of an issue right here. We do have an error message. 335 00:15:55,559 --> 00:15:56,570 Don't worry, 336 00:15:56,700 --> 00:16:00,299 I'm going to show you how we can handle errors in the next video. OK? 337 00:16:00,309 --> 00:16:02,020 But let me run this one once again 338 00:16:02,159 --> 00:16:04,200 and type in, let's say five, 339 00:16:04,549 --> 00:16:05,049 OK? 340 00:16:06,010 --> 00:16:07,830 Type in five type in eight, 341 00:16:08,059 --> 00:16:08,820 done. 342 00:16:09,250 --> 00:16:10,739 OK. So it still works fine. 343 00:16:10,960 --> 00:16:11,510 So 344 00:16:11,619 --> 00:16:16,530 we made sure that we've assigned the numbers added by the user 345 00:16:16,659 --> 00:16:18,109 to the variable called num. 346 00:16:18,280 --> 00:16:21,429 And then we appended num to the numbers 347 00:16:21,440 --> 00:16:23,320 list using this particular function right here. 348 00:16:23,330 --> 00:16:24,390 Numbers dot append 349 00:16:24,809 --> 00:16:25,510 in num. 350 00:16:25,789 --> 00:16:26,349 OK. 351 00:16:26,700 --> 00:16:27,559 Now, 352 00:16:27,820 --> 00:16:31,010 because the user actually added some numbers, 353 00:16:31,239 --> 00:16:34,799 we wanted the program to check if any of those numbers were actually even. 354 00:16:34,809 --> 00:16:35,719 And, and by doing so, 355 00:16:35,729 --> 00:16:40,409 we had to create a loop that will run through all the numbers in the numbers list. 356 00:16:40,609 --> 00:16:44,719 And then if the number was divisible by two with no remainder, 357 00:16:44,909 --> 00:16:49,400 simply say, OK, we found the very first even number printed that number. 358 00:16:49,409 --> 00:16:53,270 Otherwise, if the user did not add any even numbers simply say no, 359 00:16:53,280 --> 00:16:55,200 even numbers were entered by the user. 360 00:16:55,900 --> 00:16:57,239 And at the end of the day, 361 00:16:57,489 --> 00:17:00,919 simply print out the numbers that were added by the user. 362 00:17:01,109 --> 00:17:05,170 And if the user did not add any number, simply say no numbers were entered by the user, 363 00:17:05,180 --> 00:17:06,500 that's exactly what we did 364 00:17:06,890 --> 00:17:08,348 right here. 365 00:17:08,858 --> 00:17:13,469 So feel free to go through this program as many times as you need. 366 00:17:13,598 --> 00:17:16,439 Hopefully, it was relatively straightforward. 367 00:17:17,020 --> 00:17:18,170 And of course, as always, 368 00:17:18,180 --> 00:17:21,598 if you have any questions about anything we've done in here that you're not, 369 00:17:21,839 --> 00:17:23,800 you know, you're not exactly sure. 370 00:17:24,260 --> 00:17:25,800 Always feel free to reach out to me. 371 00:17:25,810 --> 00:17:28,770 I'll be more than happy to answer whatever questions that you have. 372 00:17:29,010 --> 00:17:29,569 So German 373 00:17:29,770 --> 00:17:30,880 next video where 374 00:17:31,199 --> 00:17:36,400 we'll now begin to take a look at how we can handle errors in our program.