1 00:00:11,840 --> 00:00:12,980 Hello, everybody. 2 00:00:13,730 --> 00:00:21,110 Now, I can say surely that we are over all of the theory regarding why we have seen some basics and 3 00:00:21,110 --> 00:00:28,730 we have been over the advanced all the topics that we have been through while loops are behind us now, 4 00:00:28,760 --> 00:00:34,300 we have seen many examples in the previous lectures, and I think that we are ready now to start practicing. 5 00:00:34,310 --> 00:00:34,620 All right. 6 00:00:35,090 --> 00:00:42,500 So before we begin, I just want to give you a warning, a heads up, that this challenge of completing 7 00:00:42,500 --> 00:00:44,330 these assignments would be a bit harder. 8 00:00:44,570 --> 00:00:44,900 All right. 9 00:00:44,900 --> 00:00:51,470 So we're getting closer to some high level topics, which are a bit more complicated and challenging. 10 00:00:51,620 --> 00:00:57,470 But again, if you went over all of my lectures regarding python development, I'm sure that you can 11 00:00:57,470 --> 00:01:03,290 overcome these assignments easily because there is no topics here that we haven't covered in previous 12 00:01:03,290 --> 00:01:03,800 lectures. 13 00:01:04,040 --> 00:01:10,730 All topics in these assignments appear in previous lectures of Python programming that are in this course. 14 00:01:11,990 --> 00:01:12,410 All right. 15 00:01:12,420 --> 00:01:15,470 So first of all, let's begin from Pardey. 16 00:01:15,860 --> 00:01:16,250 All right. 17 00:01:16,280 --> 00:01:20,170 So, first of all, please create the list of ages with these integers inside. 18 00:01:21,110 --> 00:01:28,040 Then you should add up a condition to a wire loop while the condition should be that the ages should 19 00:01:28,040 --> 00:01:29,900 be under 20, under 30. 20 00:01:30,830 --> 00:01:31,280 All right. 21 00:01:31,700 --> 00:01:33,500 And in this case, we have a list. 22 00:01:33,500 --> 00:01:33,900 All right. 23 00:01:34,100 --> 00:01:39,800 So in previous lectures, as we discussed, while loops, we always took a variable. 24 00:01:39,980 --> 00:01:40,520 All right. 25 00:01:40,940 --> 00:01:42,200 It was something like this. 26 00:01:42,300 --> 00:01:46,080 I'm just going to talk regarding this this assignment right here. 27 00:01:46,490 --> 00:01:55,640 So in previous lectures, we have created a variable number, for example, and then we had wild number. 28 00:01:56,910 --> 00:01:59,970 This hour to correct massive capital, while no. 29 00:02:01,440 --> 00:02:13,560 Is smaller than 30 and then blah, blah, blah, and then, hey, here, we had this sort of thing, 30 00:02:14,280 --> 00:02:14,680 right? 31 00:02:14,940 --> 00:02:22,880 So this was actually mean that on each cycle grow this number by one and this is how we handled a loop. 32 00:02:22,950 --> 00:02:23,320 All right. 33 00:02:23,610 --> 00:02:25,740 But in this case, we have something bit challenging. 34 00:02:25,770 --> 00:02:26,670 We have a list here. 35 00:02:27,500 --> 00:02:33,650 All right, we have a list and how we overcome this, because if I create the list right. 36 00:02:35,460 --> 00:02:38,490 Haiti's out, correct, if I create a list. 37 00:02:38,580 --> 00:02:47,910 All right, so I can't just put the list right here and do expect the Willink to scan each item on each 38 00:02:47,910 --> 00:02:48,330 cycle. 39 00:02:48,360 --> 00:02:48,590 All right. 40 00:02:48,600 --> 00:02:53,210 Because it's just we throw out here the list without mentioning what you do with it. 41 00:02:53,700 --> 00:02:55,890 So we need to do something with the cells. 42 00:02:55,890 --> 00:02:56,200 Right. 43 00:02:56,400 --> 00:02:59,450 We need to each cycle to scan the cells here. 44 00:02:59,580 --> 00:03:00,690 And how do we do it? 45 00:03:00,840 --> 00:03:02,300 You have a hint here, right? 46 00:03:02,730 --> 00:03:10,140 The hint is create an additional variable, which is a counter, and then use this counter to scan the 47 00:03:10,140 --> 00:03:12,900 items on each cell, each cycle. 48 00:03:13,080 --> 00:03:13,530 All right. 49 00:03:13,660 --> 00:03:17,560 And grow this counter by one on each cycle, OK? 50 00:03:18,780 --> 00:03:23,930 If you haven't caught what I just said, just repeat it and use a counter here. 51 00:03:24,090 --> 00:03:27,330 If I give you some more clues, are basically going to give you the answer. 52 00:03:27,930 --> 00:03:28,770 Straightforward. 53 00:03:28,770 --> 00:03:33,800 And I don't want to do it because it's going to ruin the whole point of this challenge of science. 54 00:03:34,770 --> 00:03:35,230 All right. 55 00:03:35,400 --> 00:03:38,740 So this is regarding this part right here. 56 00:03:38,790 --> 00:03:40,110 OK, use a counter. 57 00:03:40,110 --> 00:03:47,640 And that way you can use to use the counter to scan each cell in the list one by one. 58 00:03:48,190 --> 00:03:48,720 All right. 59 00:03:50,220 --> 00:03:52,180 So this is regarding this part. 60 00:03:53,910 --> 00:03:54,500 All right. 61 00:03:54,510 --> 00:03:57,750 Print each tested cell inside the inside the loop. 62 00:03:57,870 --> 00:04:05,120 So each time we are is entering the cycle, print out the cell value that you're now testing. 63 00:04:05,610 --> 00:04:09,420 Once the condition is false, print the cell that caused it. 64 00:04:10,260 --> 00:04:10,730 All right. 65 00:04:10,740 --> 00:04:18,660 Because eventually we're testing your ages and the condition of the wire loop should look for ages under 66 00:04:18,660 --> 00:04:19,220 30. 67 00:04:19,380 --> 00:04:22,340 So as long as it is under 30, it's OK. 68 00:04:22,530 --> 00:04:29,360 But once we get to this bar, for example, so the the loop should fail because it's over 30. 69 00:04:29,850 --> 00:04:37,380 OK, so please, outside the wire loop print the value that caused the wire to fail. 70 00:04:38,440 --> 00:04:41,570 All right, I am OK. 71 00:04:41,710 --> 00:04:48,670 And at the end, add an empty line between Partain Barbie Pabi, OK, you remember I just I showed you 72 00:04:49,030 --> 00:04:53,770 several times in previous videos how to create a an empty line. 73 00:04:53,770 --> 00:05:01,180 And this is just going to be for separating the output's inside the run console once we run all these 74 00:05:01,210 --> 00:05:01,690 assignments. 75 00:05:01,690 --> 00:05:05,170 So it won't be mixed like all the output's won't be mixed. 76 00:05:05,740 --> 00:05:13,300 OK, so from here, let's go to part B right here in part B, I just want you to use the same list. 77 00:05:13,300 --> 00:05:15,340 Don't even create it again. 78 00:05:15,640 --> 00:05:22,030 Just just, you know, create a wire loop and inside the wire loop, you should use this list. 79 00:05:22,480 --> 00:05:22,890 All right. 80 00:05:23,020 --> 00:05:27,010 There's no need to create an additional E duplicate this one. 81 00:05:27,040 --> 00:05:29,290 No need for that aim. 82 00:05:29,470 --> 00:05:29,760 All right. 83 00:05:29,770 --> 00:05:34,990 To create a new Y loop with the same with the same stop condition as in part A. 84 00:05:35,510 --> 00:05:39,640 OK, here we have this stop stop condition. 85 00:05:40,570 --> 00:05:46,540 And also, if the H is bigger than 20, stop the wire loop from inside. 86 00:05:47,250 --> 00:05:53,340 OK, we have discussed this topic as well in the advanced lectures, in these advanced lecture. 87 00:05:54,190 --> 00:05:58,280 How can we stop a while loop from inside. 88 00:05:58,420 --> 00:05:58,900 All right. 89 00:05:59,470 --> 00:06:09,400 Regardless of the regardless of the condition that we have inside the wire loop itself, like the condition 90 00:06:09,400 --> 00:06:12,850 that we have in the wire loop, obviously is while. 91 00:06:13,850 --> 00:06:22,490 While X is smaller than 10, so this is the stop condition once it becomes false, so the Y stops to 92 00:06:22,490 --> 00:06:27,800 run, but we also learned how can we stop it from inside the wild, from right here. 93 00:06:27,860 --> 00:06:28,310 All right. 94 00:06:28,670 --> 00:06:37,150 So just stop it using the topic that we have covered in the advanced lecture from inside the wild. 95 00:06:37,820 --> 00:06:38,170 All right. 96 00:06:38,180 --> 00:06:44,150 And right before you stop the pretested value out of the list, I want you to print out the value that 97 00:06:44,150 --> 00:06:45,440 caused the stop. 98 00:06:45,650 --> 00:06:46,060 All right? 99 00:06:46,070 --> 00:06:51,530 Because we want if ages is bigger, if age is bigger than 20, then stop the. 100 00:06:51,890 --> 00:06:56,210 So please print the value that caused this stop to be initiated. 101 00:06:58,780 --> 00:07:03,210 All right, from here, let's go to party, all right. 102 00:07:04,130 --> 00:07:11,290 So please create a while loop based on the list from point A, but this time looks condition should 103 00:07:11,290 --> 00:07:14,850 check whether the age is smaller than 74. 104 00:07:15,370 --> 00:07:15,910 All right. 105 00:07:17,020 --> 00:07:20,440 Whether the age is smaller, I actually want to change it. 106 00:07:21,520 --> 00:07:29,800 If the age is smaller than 70, right on each cycle of the loop, change lists sales to be plus two 107 00:07:30,010 --> 00:07:30,990 and printed. 108 00:07:31,330 --> 00:07:37,750 OK, so we have learned in the lists, lists, lecture, how can we change cell values? 109 00:07:37,760 --> 00:07:43,810 And I want you on each cycle of this while to add plus two to the existing cell value. 110 00:07:44,210 --> 00:07:44,650 Right. 111 00:07:44,660 --> 00:07:47,200 So please recall, how do you do it? 112 00:07:47,200 --> 00:07:53,490 And if you don't remember, just go back to this lecture and see how we are doing it over there. 113 00:07:54,250 --> 00:08:01,000 And at the end, if the loop reaches to the number seventy two, we changed it to 70. 114 00:08:02,080 --> 00:08:11,950 It should run and part with the print I'm inside or else because of and then print here the least cell 115 00:08:12,130 --> 00:08:16,420 that caused it to go inside inside the cells. 116 00:08:16,720 --> 00:08:21,580 OK, so once that number reaches 270, which is our condition. 117 00:08:22,060 --> 00:08:24,760 All right, we have only the condition here. 118 00:08:24,940 --> 00:08:29,050 The condition is the wire loops, the wireless condition. 119 00:08:29,050 --> 00:08:29,370 Right. 120 00:08:29,680 --> 00:08:33,100 So once it reaches 270, it should go to else. 121 00:08:33,380 --> 00:08:40,210 And once you go to else, print this line, I'm inside or else because ofthe and mentioned here that 122 00:08:40,210 --> 00:08:41,530 liste cell value. 123 00:08:42,220 --> 00:08:44,720 OK, I think that's that's about it. 124 00:08:45,760 --> 00:08:51,280 Again, I don't want to give you some additional hints because I think it's pretty clear what to do 125 00:08:51,280 --> 00:08:51,610 here. 126 00:08:51,820 --> 00:08:55,060 It doesn't mean that these assignments are not challenging. 127 00:08:55,070 --> 00:08:55,350 Right. 128 00:08:55,510 --> 00:09:01,210 When I'm saying it's clear what to do, meaning that it's clear that you need to fight with the code. 129 00:09:01,360 --> 00:09:03,930 You need to struggle until you get to the solution. 130 00:09:03,940 --> 00:09:05,640 It's not meant to be easy. 131 00:09:05,860 --> 00:09:06,280 All right. 132 00:09:06,460 --> 00:09:12,610 But I'm sure and I know that you have all of the tools to resolve all of these assignments by yourselves, 133 00:09:13,420 --> 00:09:14,920 surely by 100 percent. 134 00:09:15,460 --> 00:09:15,910 All right. 135 00:09:15,910 --> 00:09:19,420 And if you get into trouble, that that's OK as well. 136 00:09:19,600 --> 00:09:20,970 So you can watch the next video. 137 00:09:20,980 --> 00:09:25,690 Well, I give you the answers for these assignments, and you also can verify your answers by watching 138 00:09:25,690 --> 00:09:26,290 the next video. 139 00:09:26,980 --> 00:09:27,550 Thank you. 140 00:09:27,730 --> 00:09:29,140 And we'll see you in the next lecture.