1 00:00:00,000 --> 00:00:00,893 2 00:00:00,893 --> 00:00:02,810 MARGARET TANZOSH: So what I'm going to do now, 3 00:00:02,810 --> 00:00:07,160 I'm going to talk a little bit about specifically how I do scaffolding 4 00:00:07,160 --> 00:00:09,440 for really struggling students. 5 00:00:09,440 --> 00:00:11,850 And you're going to actually do some work as well. 6 00:00:11,850 --> 00:00:13,880 So I'm going to talk about it for a few moments. 7 00:00:13,880 --> 00:00:17,360 Then I'm going to ask you, if you have a laptop, to take out your laptop, 8 00:00:17,360 --> 00:00:20,510 and we can do a little bit of pseudo coding together. 9 00:00:20,510 --> 00:00:22,710 We'll kind of talk about how we would do that. 10 00:00:22,710 --> 00:00:30,830 And then if you don't have a laptop, I have a printout for you. 11 00:00:30,830 --> 00:00:31,740 Got it? 12 00:00:31,740 --> 00:00:34,700 But if you have a laptop, do you take a laptop, 13 00:00:34,700 --> 00:00:37,235 take it out so that you can have that ready. 14 00:00:37,235 --> 00:00:51,328 15 00:00:51,328 --> 00:00:52,370 We're not going to start. 16 00:00:52,370 --> 00:00:53,080 We'll do that later. 17 00:00:53,080 --> 00:00:54,940 I'm going to go through a few slides first. 18 00:00:54,940 --> 00:00:56,648 And then we'll give out all the handouts. 19 00:00:56,648 --> 00:01:05,690 20 00:01:05,690 --> 00:01:08,510 So you don't need the printouts yet, right? 21 00:01:08,510 --> 00:01:13,740 I've just got to go through a few slides first, kind of introduce what I do, 22 00:01:13,740 --> 00:01:15,530 how I differentiate. 23 00:01:15,530 --> 00:01:19,400 And then we'll do a little bit of pseudo coding together. 24 00:01:19,400 --> 00:01:21,230 I'll share with you how I do it. 25 00:01:21,230 --> 00:01:23,870 And again, you don't have to do anything that I do. 26 00:01:23,870 --> 00:01:27,290 It's just to kind of give you an example of something you may want to consider. 27 00:01:27,290 --> 00:01:35,990 28 00:01:35,990 --> 00:01:40,850 So what I was saying before, of course-- and I think many of you 29 00:01:40,850 --> 00:01:46,070 had the same concerns-- is that I have a very diverse set of students, right? 30 00:01:46,070 --> 00:01:50,840 Most of them have no computer science experience. 31 00:01:50,840 --> 00:01:54,590 Some of them struggle with abstract thinking. 32 00:01:54,590 --> 00:01:57,868 They struggle with algebra, some of them. 33 00:01:57,868 --> 00:02:00,035 I'll wait for a moment for everybody to get settled. 34 00:02:00,035 --> 00:02:05,160 35 00:02:05,160 --> 00:02:07,800 Some students come in very advanced. 36 00:02:07,800 --> 00:02:11,070 Some students have no experience, but they pick it up very quickly, 37 00:02:11,070 --> 00:02:12,730 and they fall in love with it. 38 00:02:12,730 --> 00:02:17,230 Some students take a while to warm up to it, right? 39 00:02:17,230 --> 00:02:20,400 So it's kind of all over the place in terms of when I first 40 00:02:20,400 --> 00:02:23,730 meet my students every year. 41 00:02:23,730 --> 00:02:27,930 I had one student that started the class saying-- 42 00:02:27,930 --> 00:02:30,540 because I had 34 kids in the class-- 43 00:02:30,540 --> 00:02:33,840 that you never come over and help me, so I'm not going to pass anyway. 44 00:02:33,840 --> 00:02:36,810 So I'm not going to bother to do anything. 45 00:02:36,810 --> 00:02:39,960 He's now one of the best students in class. 46 00:02:39,960 --> 00:02:44,350 So it took a little time, but eventually it warmed up. 47 00:02:44,350 --> 00:02:44,940 He got it. 48 00:02:44,940 --> 00:02:48,730 He was able to kind of do the programs without any help from me at all. 49 00:02:48,730 --> 00:02:51,540 So he's doing great. 50 00:02:51,540 --> 00:02:53,520 So how do I keep everybody engaged? 51 00:02:53,520 --> 00:02:56,740 So I think engagement is obviously really important. 52 00:02:56,740 --> 00:03:00,300 I know myself, I was fortunate when I was in high school, 53 00:03:00,300 --> 00:03:04,260 I was a pretty good math student, maybe not as good in every other subject. 54 00:03:04,260 --> 00:03:05,680 But I was a good math student. 55 00:03:05,680 --> 00:03:09,420 And I always hated when I finished the problem and I was done. 56 00:03:09,420 --> 00:03:10,920 I always wanted more challenges. 57 00:03:10,920 --> 00:03:12,960 I didn't like being bored, right? 58 00:03:12,960 --> 00:03:16,440 And so I think it's really important for students 59 00:03:16,440 --> 00:03:20,380 to be able to be excited in class and not feel like, OK, I'm done. 60 00:03:20,380 --> 00:03:23,070 So I'm just going to open up the chess program on my computer 61 00:03:23,070 --> 00:03:26,220 and do something else or do work for another class. 62 00:03:26,220 --> 00:03:30,030 I want them to have something to keep learning, to go as far as they can, 63 00:03:30,030 --> 00:03:30,570 right? 64 00:03:30,570 --> 00:03:33,690 And then others need that extra support to get to the level 65 00:03:33,690 --> 00:03:36,100 that they can begin to be productive. 66 00:03:36,100 --> 00:03:39,910 So of course, differentiation, I do it on many different levels. 67 00:03:39,910 --> 00:03:42,600 So of course, we have the CS50 problem sets, 68 00:03:42,600 --> 00:03:45,240 where students can self select the problems 69 00:03:45,240 --> 00:03:46,710 they're going to work on, right? 70 00:03:46,710 --> 00:03:49,620 The materials are there that they can, if they're 71 00:03:49,620 --> 00:03:52,530 an advanced student and they come in-- or they kind of 72 00:03:52,530 --> 00:03:54,870 get into it really quickly. 73 00:03:54,870 --> 00:03:56,640 There's so much material online, right? 74 00:03:56,640 --> 00:03:57,810 There's the walkthroughs. 75 00:03:57,810 --> 00:03:59,190 There's the shorts. 76 00:03:59,190 --> 00:04:00,990 There's the lectures, right? 77 00:04:00,990 --> 00:04:01,980 There's notes. 78 00:04:01,980 --> 00:04:03,780 There's so much material online. 79 00:04:03,780 --> 00:04:06,300 There are sample codes that Professor Malan doesn't 80 00:04:06,300 --> 00:04:08,290 lecture that are available to you. 81 00:04:08,290 --> 00:04:11,700 So there are so many examples and so much material 82 00:04:11,700 --> 00:04:14,040 online for advanced students. 83 00:04:14,040 --> 00:04:16,380 They are often able to move ahead on their own. 84 00:04:16,380 --> 00:04:19,500 They sometimes never even ask me for help. 85 00:04:19,500 --> 00:04:21,700 Some, of course, ask me for help every day. 86 00:04:21,700 --> 00:04:23,970 So there's a large span, right? 87 00:04:23,970 --> 00:04:27,480 One thing I do do is that-- and it's kind of something 88 00:04:27,480 --> 00:04:29,310 that Professor Malan mentioned also. 89 00:04:29,310 --> 00:04:33,060 So for students that finish early, I'll keep a chart 90 00:04:33,060 --> 00:04:36,870 on the wall, a big poster for every problem that they work on. 91 00:04:36,870 --> 00:04:39,400 And if they're willing-- and every student is not up for it. 92 00:04:39,400 --> 00:04:42,660 But if they're willing, if they finish maybe Mario very quickly, 93 00:04:42,660 --> 00:04:45,420 they might become a class expert on Mario. 94 00:04:45,420 --> 00:04:47,880 So I'll put them on the expert list. 95 00:04:47,880 --> 00:04:50,422 They're going to be part of our experts for that problem. 96 00:04:50,422 --> 00:04:52,380 And now I make sure all the other students know 97 00:04:52,380 --> 00:04:55,172 they could look if they're working on Mario and they're struggling, 98 00:04:55,172 --> 00:04:57,240 and I'm busy working with a student over here, 99 00:04:57,240 --> 00:04:59,850 they could go to the student on that poster, right? 100 00:04:59,850 --> 00:05:01,620 I give them some extra credit for it. 101 00:05:01,620 --> 00:05:06,330 And of course, they have the prestige of being an expert, right? 102 00:05:06,330 --> 00:05:08,232 The extra credit usually helps a lot, too. 103 00:05:08,232 --> 00:05:10,440 They always like to get a little extra credit, right? 104 00:05:10,440 --> 00:05:12,960 So I'll ask them to do that and. 105 00:05:12,960 --> 00:05:15,510 That helps a lot to kind of keep the class going 106 00:05:15,510 --> 00:05:18,977 when I'm not able to be there to help every single student. 107 00:05:18,977 --> 00:05:21,810 And then again, we're going to take a look today at the scaffolding. 108 00:05:21,810 --> 00:05:25,967 And I often do allow struggling students extra time. 109 00:05:25,967 --> 00:05:28,050 And I know that's something different schools have 110 00:05:28,050 --> 00:05:29,700 different philosophies on that. 111 00:05:29,700 --> 00:05:31,770 But again, I don't want a student feeling 112 00:05:31,770 --> 00:05:35,130 so stressed because they have six other subjects they're working on, 113 00:05:35,130 --> 00:05:37,590 or this is just something they take more time-- 114 00:05:37,590 --> 00:05:40,810 they need more time to get used to understanding how to do this. 115 00:05:40,810 --> 00:05:43,140 I don't want them to feel so stressed on Thursday night 116 00:05:43,140 --> 00:05:45,557 that they have to debug their code to submit it by Friday, 117 00:05:45,557 --> 00:05:47,250 or they're going to fail. 118 00:05:47,250 --> 00:05:49,590 So I often will give them extra time. 119 00:05:49,590 --> 00:05:53,310 And I do let them know if they're struggling with a problem, of course, 120 00:05:53,310 --> 00:05:56,980 I don't want them to feel that pressure to copy a solution from a friend, 121 00:05:56,980 --> 00:05:57,480 right? 122 00:05:57,480 --> 00:05:58,867 And there's always that concern. 123 00:05:58,867 --> 00:06:01,450 I don't want them to feel if they have to get it in tomorrow-- 124 00:06:01,450 --> 00:06:02,620 they don't know what to do. 125 00:06:02,620 --> 00:06:04,870 The only thing they could do is copy it from a friend. 126 00:06:04,870 --> 00:06:08,970 So that's why I say, if you struggle, come to me, ask me, and in most cases, 127 00:06:08,970 --> 00:06:10,650 I give you the extra time to have-- 128 00:06:10,650 --> 00:06:11,730 I'll explain it to you. 129 00:06:11,730 --> 00:06:12,563 We'll break it down. 130 00:06:12,563 --> 00:06:13,600 We'll look at it again. 131 00:06:13,600 --> 00:06:16,080 And so I try to really stress that over and over again. 132 00:06:16,080 --> 00:06:18,960 133 00:06:18,960 --> 00:06:21,510 At times-- and I don't do this for everything. 134 00:06:21,510 --> 00:06:24,510 But at the very, very end of the semester, when 135 00:06:24,510 --> 00:06:26,370 the problem sets are getting much harder, 136 00:06:26,370 --> 00:06:30,632 and I have a couple of students who just really have some issues-- 137 00:06:30,632 --> 00:06:33,090 and it might not even just be issues with computer science, 138 00:06:33,090 --> 00:06:36,870 but other issues with staying organized or other things 139 00:06:36,870 --> 00:06:37,920 going on in their lives. 140 00:06:37,920 --> 00:06:41,340 I will sometimes allow them to do an alternate writing assignment 141 00:06:41,340 --> 00:06:43,320 to replace a programming problem. 142 00:06:43,320 --> 00:06:45,840 But it would have to be something where they do research 143 00:06:45,840 --> 00:06:50,790 maybe a current issue in technology or writing about a particular new product 144 00:06:50,790 --> 00:06:53,850 so that it's still technology related, but that it's 145 00:06:53,850 --> 00:06:56,970 another way that they could get credit and not fear 146 00:06:56,970 --> 00:06:58,860 that they're going to fail the class-- 147 00:06:58,860 --> 00:07:02,490 get credit for it but maybe do something, an alternate assignment. 148 00:07:02,490 --> 00:07:04,230 Again, I don't do that for many problems. 149 00:07:04,230 --> 00:07:07,188 It's usually at the ends of the semester or at the end of the year when 150 00:07:07,188 --> 00:07:10,890 the difficulty ramps up, and they're just not really there yet, 151 00:07:10,890 --> 00:07:12,580 and the books are closing. 152 00:07:12,580 --> 00:07:13,800 I need to get the grades in. 153 00:07:13,800 --> 00:07:18,270 I might say, OK, I'll give them an alternative to do. 154 00:07:18,270 --> 00:07:21,000 Another thing I've created a couple of years ago-- 155 00:07:21,000 --> 00:07:24,390 I didn't use this year because I tried to use all the practice problems. 156 00:07:24,390 --> 00:07:26,010 But I'll make these available to you. 157 00:07:26,010 --> 00:07:29,260 They're not going to be available-- they may not be available after the summer 158 00:07:29,260 --> 00:07:33,480 because this is an older CS50 lab environment that 159 00:07:33,480 --> 00:07:34,710 is going to be going away. 160 00:07:34,710 --> 00:07:36,090 Maybe something will substitute. 161 00:07:36,090 --> 00:07:37,050 I'm not sure how it's going to work. 162 00:07:37,050 --> 00:07:38,383 But you can have them right now. 163 00:07:38,383 --> 00:07:40,560 I'll give you the whole list of all of these. 164 00:07:40,560 --> 00:07:44,040 I made these little skills-based CS50 labs. 165 00:07:44,040 --> 00:07:46,140 They look a little different. 166 00:07:46,140 --> 00:07:49,060 The terminal, when you compile, it gives you a message. 167 00:07:49,060 --> 00:07:50,670 So it doesn't look exactly the same. 168 00:07:50,670 --> 00:07:52,960 But you're welcome to use them if you want. 169 00:07:52,960 --> 00:07:57,840 So they're very specific on specific topics, like data types 170 00:07:57,840 --> 00:08:01,830 or how to use printout for different format codes or something 171 00:08:01,830 --> 00:08:05,730 like this, where maybe we're just looking at a sorting algorithm. 172 00:08:05,730 --> 00:08:09,480 I'll particular use the sorting and searching labs 173 00:08:09,480 --> 00:08:12,510 that I've created so that the students get a chance to develop 174 00:08:12,510 --> 00:08:13,980 these algorithms on their own. 175 00:08:13,980 --> 00:08:16,380 Because for me, I feel like it's important for them 176 00:08:16,380 --> 00:08:17,760 to understand how their work. 177 00:08:17,760 --> 00:08:19,800 And the best way to understand how they work 178 00:08:19,800 --> 00:08:21,550 is for them to be able to code them. 179 00:08:21,550 --> 00:08:23,490 So again, I have a whole list of these. 180 00:08:23,490 --> 00:08:26,850 They're actually already shared if you go to-- and don't do it right now. 181 00:08:26,850 --> 00:08:29,080 But a little later, if you go to the agenda, 182 00:08:29,080 --> 00:08:31,833 you'll see there's a link for all of these labs, right? 183 00:08:31,833 --> 00:08:34,750 And again, I'm not guaranteeing they're going to work past the summer. 184 00:08:34,750 --> 00:08:39,059 But if you want to see them or get ideas for them, you're welcome to do that. 185 00:08:39,059 --> 00:08:42,150 Now, I've had a couple of students on the other side that 186 00:08:42,150 --> 00:08:44,350 move so quickly through the curriculum. 187 00:08:44,350 --> 00:08:47,880 This year, I had one student-- this has never happened in eight years before-- 188 00:08:47,880 --> 00:08:52,742 who finished the entire CS50x curriculum in the first month of school. 189 00:08:52,742 --> 00:08:53,950 I don't know how he did that. 190 00:08:53,950 --> 00:08:56,340 He obviously came in with a lot of experience. 191 00:08:56,340 --> 00:08:59,670 I've never had anybody finish the whole curriculum in one month. 192 00:08:59,670 --> 00:09:02,910 So I had him go through the CS50 Python curriculum-- 193 00:09:02,910 --> 00:09:04,410 finished that the next month. 194 00:09:04,410 --> 00:09:07,830 Then I gave him the CS50 artificial intelligence curriculum. 195 00:09:07,830 --> 00:09:08,850 He finished that. 196 00:09:08,850 --> 00:09:09,430 And now. 197 00:09:09,430 --> 00:09:11,770 I think he's working on the CS50 game curriculum. 198 00:09:11,770 --> 00:09:15,330 So there's-- the nice thing is that there are other things there 199 00:09:15,330 --> 00:09:18,420 in the CS50 universe that students can do. 200 00:09:18,420 --> 00:09:21,630 So if you have that very rare student-- and again, 201 00:09:21,630 --> 00:09:25,320 150 students over eight years, it doesn't happen often. 202 00:09:25,320 --> 00:09:27,390 Last year I did have a couple of students. 203 00:09:27,390 --> 00:09:28,832 And maybe they got very used to-- 204 00:09:28,832 --> 00:09:31,290 I think maybe when they were working remotely during COVID, 205 00:09:31,290 --> 00:09:34,020 there were a couple of students who just became very used 206 00:09:34,020 --> 00:09:36,810 to being able to work independently, look things up. 207 00:09:36,810 --> 00:09:38,935 So I had a couple of students that pretty much went 208 00:09:38,935 --> 00:09:41,102 through the curriculum, but it took a little longer. 209 00:09:41,102 --> 00:09:43,320 But they eventually got through the entire curriculum 210 00:09:43,320 --> 00:09:44,860 before the rest of the class. 211 00:09:44,860 --> 00:09:45,720 And so they also-- 212 00:09:45,720 --> 00:09:48,390 I gave them the Python curriculum to work on after that. 213 00:09:48,390 --> 00:09:51,870 So again, the goal is to always have students engaged. 214 00:09:51,870 --> 00:09:53,340 There's really so much material. 215 00:09:53,340 --> 00:09:55,710 They never really run out of something they could do. 216 00:09:55,710 --> 00:09:58,560 And the nice thing about staying in the CS50 universe 217 00:09:58,560 --> 00:10:01,470 is that there's a similar feeling and a similar workflow 218 00:10:01,470 --> 00:10:02,820 to how the programs work. 219 00:10:02,820 --> 00:10:03,930 You have a problem spec. 220 00:10:03,930 --> 00:10:04,920 You have a problem. 221 00:10:04,920 --> 00:10:06,520 You have a way of submitting it. 222 00:10:06,520 --> 00:10:09,030 And so it's a familiar environment. 223 00:10:09,030 --> 00:10:12,850 And it allows me to kind of keep them going as well. 224 00:10:12,850 --> 00:10:16,110 And then again, as I mentioned, I use the poster system 225 00:10:16,110 --> 00:10:19,140 for the CS50 TAs or experts, right? 226 00:10:19,140 --> 00:10:20,740 We call it the expert system. 227 00:10:20,740 --> 00:10:23,680 And so I do encourage students to help each other out. 228 00:10:23,680 --> 00:10:27,340 We talk a lot about how to help each other out with academic integrity. 229 00:10:27,340 --> 00:10:29,010 What does that look like, right? 230 00:10:29,010 --> 00:10:30,990 Ask good questions, give hints. 231 00:10:30,990 --> 00:10:34,200 You never let somebody look at your finished code, right? 232 00:10:34,200 --> 00:10:36,600 You never tell somebody exactly what to type in. 233 00:10:36,600 --> 00:10:39,820 And I tell them also, you're not allowed to touch their keyboard. 234 00:10:39,820 --> 00:10:43,200 I don't want an expert student going over, boop, boop, fixed it for you. 235 00:10:43,200 --> 00:10:46,020 And then the other student has no idea what happened, right? 236 00:10:46,020 --> 00:10:48,900 So we want to make sure that everybody is doing their own coding. 237 00:10:48,900 --> 00:10:54,400 So again, that helps a lot as well, particularly with large classes. 238 00:10:54,400 --> 00:10:56,100 So how do I use the scaffolding? 239 00:10:56,100 --> 00:10:58,830 So often what I'll do is that I'll bring a group-- 240 00:10:58,830 --> 00:11:00,665 I'll kind of keep track of who's doing what. 241 00:11:00,665 --> 00:11:03,540 I'll bring together a group of the students who are really struggling 242 00:11:03,540 --> 00:11:05,075 at a table in the front of the room. 243 00:11:05,075 --> 00:11:07,200 I may make other people move out of the way, right? 244 00:11:07,200 --> 00:11:08,940 So you're going to come to the front of the room. 245 00:11:08,940 --> 00:11:11,430 And then I'll have them bring their laptops with them. 246 00:11:11,430 --> 00:11:13,380 And we'll go through together, and we will 247 00:11:13,380 --> 00:11:17,265 do another walkthrough of the program, take a look at the problem spec, 248 00:11:17,265 --> 00:11:19,890 make sure where to show-- because sometimes students don't even 249 00:11:19,890 --> 00:11:22,900 know where to look to get-- where do I find the information about what I do? 250 00:11:22,900 --> 00:11:24,100 There's so much stuff here. 251 00:11:24,100 --> 00:11:26,880 So I'll make sure we go, we look at the specification. 252 00:11:26,880 --> 00:11:31,320 We make sure we understand what is expected for this particular problem, 253 00:11:31,320 --> 00:11:32,880 what's the goal here. 254 00:11:32,880 --> 00:11:36,420 Then we'll maybe just download the distribution code, 255 00:11:36,420 --> 00:11:39,630 which is usually just a main void at the beginning, right? 256 00:11:39,630 --> 00:11:43,320 And then we'll start to do a little pseudo coding together. 257 00:11:43,320 --> 00:11:45,700 And sometimes, if they're really, really struggling, 258 00:11:45,700 --> 00:11:49,180 we may even just begin to code the first couple of lines of the program. 259 00:11:49,180 --> 00:11:51,587 Maybe you do while loop to validate user input. 260 00:11:51,587 --> 00:11:52,170 You know what? 261 00:11:52,170 --> 00:11:54,310 I'll try to do it interactively with them, right? 262 00:11:54,310 --> 00:11:55,560 What are we going to test for? 263 00:11:55,560 --> 00:11:57,700 What kind of conditions should we have here? 264 00:11:57,700 --> 00:12:00,060 So we may do something like that. 265 00:12:00,060 --> 00:12:03,450 So what I wanted to do, I thought that we could try to do a little bit of this 266 00:12:03,450 --> 00:12:04,240 together. 267 00:12:04,240 --> 00:12:08,830 And then you can do this in groups. 268 00:12:08,830 --> 00:12:12,040 We'll do one program together, which is one of the practice problems. 269 00:12:12,040 --> 00:12:16,275 And then what you'll do is you'll go up to the rooms you were in yesterday, 270 00:12:16,275 --> 00:12:17,650 where you did the micro teaching. 271 00:12:17,650 --> 00:12:19,180 You'll meet with the same groups. 272 00:12:19,180 --> 00:12:22,360 If you have a laptop, take your laptop with you, right? 273 00:12:22,360 --> 00:12:23,830 And I have printouts. 274 00:12:23,830 --> 00:12:27,550 And I'll pass these around for students that don't have laptops. 275 00:12:27,550 --> 00:12:30,820 For the problem spec, I have an abbreviated version 276 00:12:30,820 --> 00:12:33,020 so it wasn't tons of paper to print out. 277 00:12:33,020 --> 00:12:36,850 But if you go to the agenda, if you go to the agenda-- 278 00:12:36,850 --> 00:12:39,850 you know the agenda for today, where you have the links for everything? 279 00:12:39,850 --> 00:12:41,475 Does everybody know where to find that? 280 00:12:41,475 --> 00:12:43,960 So under the presentation Differentiating, 281 00:12:43,960 --> 00:12:45,400 there's a bunch of links. 282 00:12:45,400 --> 00:12:49,340 So you'll see a link for-- the first link is called-- 283 00:12:49,340 --> 00:12:50,493 it's prime.c. 284 00:12:50,493 --> 00:12:53,660 And this is one of the practice problems that we're going to take a look at. 285 00:12:53,660 --> 00:12:54,910 So I'm going to pass these. 286 00:12:54,910 --> 00:12:56,620 Take one if you don't have a computer. 287 00:12:56,620 --> 00:12:59,650 Or just let me just give you maybe not quite as many. 288 00:12:59,650 --> 00:13:00,978 Hang on. 289 00:13:00,978 --> 00:13:02,270 So that I can pass them around. 290 00:13:02,270 --> 00:13:04,930 So pass them around and back if you don't have a computer. 291 00:13:04,930 --> 00:13:06,950 If you have a computer, you'll use that instead. 292 00:13:06,950 --> 00:13:08,283 So if you could pass these back. 293 00:13:08,283 --> 00:13:12,452 If you don't have a computer, you can take one of the printouts. 294 00:13:12,452 --> 00:13:13,602 AUDIENCE: [INAUDIBLE] 295 00:13:13,602 --> 00:13:14,560 MARGARET TANZOSH: Sure. 296 00:13:14,560 --> 00:13:17,080 Take what you need and pass them back, please. 297 00:13:17,080 --> 00:13:21,170 298 00:13:21,170 --> 00:13:26,450 So if you do not have a computer, take a printout. 299 00:13:26,450 --> 00:13:30,460 If you don't have a computer, take a printout or just pass it back. 300 00:13:30,460 --> 00:13:31,540 Anyway. 301 00:13:31,540 --> 00:13:33,228 DAVID MALAN: [INAUDIBLE] 302 00:13:33,228 --> 00:13:34,270 MARGARET TANZOSH: Oh, OK. 303 00:13:34,270 --> 00:13:34,900 All right. 304 00:13:34,900 --> 00:13:35,456 Yeah. 305 00:13:35,456 --> 00:13:36,150 DAVID MALAN: [INAUDIBLE] 306 00:13:36,150 --> 00:13:37,300 MARGARET TANZOSH: Yeah, we can keep them in here. 307 00:13:37,300 --> 00:13:39,008 I wanted them to work together in groups. 308 00:13:39,008 --> 00:13:42,710 So they could just work on their tables with the people around them. 309 00:13:42,710 --> 00:13:44,050 That's fine. 310 00:13:44,050 --> 00:13:46,880 So if you don't have a computer, take it and hand it back. 311 00:13:46,880 --> 00:13:47,630 That's no problem. 312 00:13:47,630 --> 00:13:50,170 So we've actually got a little change of plan. 313 00:13:50,170 --> 00:13:52,510 We're not going to go to the groups from yesterday. 314 00:13:52,510 --> 00:13:54,140 We're going to work in groups here. 315 00:13:54,140 --> 00:13:56,260 It just makes it easier. 316 00:13:56,260 --> 00:13:58,570 They're coming back here. 317 00:13:58,570 --> 00:14:00,550 The printouts are coming back. 318 00:14:00,550 --> 00:14:02,650 If you don't have printouts, I have more here. 319 00:14:02,650 --> 00:14:05,560 320 00:14:05,560 --> 00:14:07,240 Anybody still need printouts? 321 00:14:07,240 --> 00:14:20,330 322 00:14:20,330 --> 00:14:24,180 Everybody have a printout that doesn't have a laptop? 323 00:14:24,180 --> 00:14:25,790 Yeah? 324 00:14:25,790 --> 00:14:26,290 OK. 325 00:14:26,290 --> 00:14:32,210 326 00:14:32,210 --> 00:14:34,490 Everybody good? 327 00:14:34,490 --> 00:14:36,986 Here's a couple extras, in case anyone else [INAUDIBLE].. 328 00:14:36,986 --> 00:14:59,710 329 00:14:59,710 --> 00:15:08,270 So if you go to the Agenda for today, when you come down here, 330 00:15:08,270 --> 00:15:09,520 Differentiate for [INAUDIBLE]. 331 00:15:09,520 --> 00:15:11,620 So you're going to see links here, right? 332 00:15:11,620 --> 00:15:14,770 And the first link, when you open it up, this 333 00:15:14,770 --> 00:15:18,470 is going to be one of the practice problems that we talked about. 334 00:15:18,470 --> 00:15:21,100 So it's just a simple-- the practice problems are just 335 00:15:21,100 --> 00:15:24,190 on single, little topics, one or two little topics. 336 00:15:24,190 --> 00:15:26,110 There's always learning goals on the top. 337 00:15:26,110 --> 00:15:31,600 This is to get some practice using for loops, also some practice using modulo, 338 00:15:31,600 --> 00:15:36,370 and some practice creating a Boolean function. 339 00:15:36,370 --> 00:15:39,430 So since this deals with for loops, it might be something 340 00:15:39,430 --> 00:15:44,380 that you want to use with students, get some practice, before starting Mario. 341 00:15:44,380 --> 00:15:48,010 Because Mario's going to depend on for loops, right? 342 00:15:48,010 --> 00:15:50,630 And then what I'm going to do is I'm actually 343 00:15:50,630 --> 00:15:53,380 going to open my code space as well, which I thought I had opened, 344 00:15:53,380 --> 00:15:54,745 but I guess it closed. 345 00:15:54,745 --> 00:15:59,450 346 00:15:59,450 --> 00:16:03,482 So if you have a laptop, you could go to the problems back here. 347 00:16:03,482 --> 00:16:05,690 What I want to do is let's just walk through a little 348 00:16:05,690 --> 00:16:07,010 what this is going to do. 349 00:16:07,010 --> 00:16:09,650 There's a lot of code that is already supplied. 350 00:16:09,650 --> 00:16:12,890 And basically you're just completing a function. 351 00:16:12,890 --> 00:16:15,665 Has everybody that has a laptop able to find this link? 352 00:16:15,665 --> 00:16:16,493 AUDIENCE: Yeah. 353 00:16:16,493 --> 00:16:17,660 MARGARET TANZOSH: All right. 354 00:16:17,660 --> 00:16:20,420 355 00:16:20,420 --> 00:16:27,690 So it's just a short, little program to generate prime numbers. 356 00:16:27,690 --> 00:16:30,090 And we have some distribution code here. 357 00:16:30,090 --> 00:16:32,160 And then we have our implementation details. 358 00:16:32,160 --> 00:16:36,130 So I always like to point out to students, 359 00:16:36,130 --> 00:16:40,740 let's take a look at the section under Implementation Details to kind of focus 360 00:16:40,740 --> 00:16:45,150 their eyes in a particular place on the problem specs. 361 00:16:45,150 --> 00:16:47,700 So I give a hint here, right? 362 00:16:47,700 --> 00:16:50,580 The easiest way to check if the number is prime 363 00:16:50,580 --> 00:16:53,250 is to try to divide it by every number from 2 364 00:16:53,250 --> 00:16:55,530 up to but not including the number itself. 365 00:16:55,530 --> 00:16:57,510 If it divides with no remainder-- 366 00:16:57,510 --> 00:17:02,040 367 00:17:02,040 --> 00:17:02,970 I guess that's a typo. 368 00:17:02,970 --> 00:17:06,030 If it divides with a remainder, it's not prime, right? 369 00:17:06,030 --> 00:17:09,270 So the main function has a for loop, right? 370 00:17:09,270 --> 00:17:12,710 So really, you're creating the inner for loop of two nested for loops. 371 00:17:12,710 --> 00:17:14,460 The main function is a for loop that looks 372 00:17:14,460 --> 00:17:17,280 at every number within a particular range. 373 00:17:17,280 --> 00:17:19,530 And then you're going to be completing a function that 374 00:17:19,530 --> 00:17:22,349 checks that number and returns true or false, 375 00:17:22,349 --> 00:17:25,290 depending on whether or not the number is prime. 376 00:17:25,290 --> 00:17:28,319 So what I'm going to do, I'm going to start with-- 377 00:17:28,319 --> 00:17:30,420 and you can do this if you have a laptop as well. 378 00:17:30,420 --> 00:17:31,740 Do it with me. 379 00:17:31,740 --> 00:17:37,440 Copy the line and then in the codespace, we're going to-- 380 00:17:37,440 --> 00:17:40,897 see, what happened to my codespace? 381 00:17:40,897 --> 00:17:43,605 What we're going to do is we'll start with the distribution code. 382 00:17:43,605 --> 00:17:46,420 383 00:17:46,420 --> 00:17:50,510 Now, before you do this with students, you 384 00:17:50,510 --> 00:17:53,570 may want to have the solution printed out next to you 385 00:17:53,570 --> 00:17:57,215 so that you kind of remember exactly what you're going to do to get there. 386 00:17:57,215 --> 00:18:00,520 387 00:18:00,520 --> 00:18:02,710 So here is the distribution code. 388 00:18:02,710 --> 00:18:05,500 389 00:18:05,500 --> 00:18:10,580 So what I might do next is that I'll walk through with students, 390 00:18:10,580 --> 00:18:14,140 what exactly is this code doing because sometimes students 391 00:18:14,140 --> 00:18:17,560 are still just learning to, particularly if this is a unit one problem, 392 00:18:17,560 --> 00:18:19,510 understands some basic stuff, right? 393 00:18:19,510 --> 00:18:22,490 So I might just ask them, what is this? 394 00:18:22,490 --> 00:18:24,460 Why do we hash, include, cs50.h? 395 00:18:24,460 --> 00:18:25,990 What does that allow us to do? 396 00:18:25,990 --> 00:18:30,250 Why we including standard io.h, right? 397 00:18:30,250 --> 00:18:32,530 Mention this is the function prototype of the function 398 00:18:32,530 --> 00:18:34,300 you're going to create, right? 399 00:18:34,300 --> 00:18:36,550 Maybe ask some questions about it. 400 00:18:36,550 --> 00:18:39,070 We have our main function, right? 401 00:18:39,070 --> 00:18:44,110 We have a typical do while loop, where it's declaring a new variable, right? 402 00:18:44,110 --> 00:18:46,480 And then I might even mention to the students, 403 00:18:46,480 --> 00:18:49,930 why do I have to declare the variable before my do while loop just 404 00:18:49,930 --> 00:18:53,540 as a way of reviewing some key concepts. 405 00:18:53,540 --> 00:18:57,820 So basically we're just getting a minimum and a maximum value, 406 00:18:57,820 --> 00:19:01,990 where the minimum is going to be cannot be less than 1. 407 00:19:01,990 --> 00:19:05,740 And the maximum has to be at least as big as the so 408 00:19:05,740 --> 00:19:08,680 that we don't take some bad inputs up front. 409 00:19:08,680 --> 00:19:11,780 410 00:19:11,780 --> 00:19:14,720 So then we have a for loop that's given to us. 411 00:19:14,720 --> 00:19:18,170 That starts at the minimum number, whatever that's given. 412 00:19:18,170 --> 00:19:22,310 And it iterates through the maximum inclusive. 413 00:19:22,310 --> 00:19:25,220 And then we execute this function. 414 00:19:25,220 --> 00:19:28,800 I might say that prime is going to return true or false. 415 00:19:28,800 --> 00:19:30,080 So I could also do this. 416 00:19:30,080 --> 00:19:32,970 And I might just show the student how I could just say, 417 00:19:32,970 --> 00:19:35,660 if prime, because that is true or false, or I 418 00:19:35,660 --> 00:19:40,190 could save prime equals with the input of i, equals equals true. 419 00:19:40,190 --> 00:19:42,860 And then I'll make sure to mention that we're 420 00:19:42,860 --> 00:19:46,760 going to be testing because the input for the function, the argument that's 421 00:19:46,760 --> 00:19:50,510 being passed to it is going to start where i starts, which 422 00:19:50,510 --> 00:19:53,030 is the minimum value input up here. 423 00:19:53,030 --> 00:19:55,620 It's going to iterate through the maximum value. 424 00:19:55,620 --> 00:20:00,530 And if necessary, I might remind them how a for loop works, right? 425 00:20:00,530 --> 00:20:04,970 We have the setup version of for loop, the setup portion that 426 00:20:04,970 --> 00:20:07,040 runs once the initialization phase-- 427 00:20:07,040 --> 00:20:09,410 our condition to determine if it's going to run. 428 00:20:09,410 --> 00:20:18,110 And then we have iteration, which executes after the loop is executed. 429 00:20:18,110 --> 00:20:20,510 So I'm going to be using the function here 430 00:20:20,510 --> 00:20:23,010 to determine if the number is true. 431 00:20:23,010 --> 00:20:25,650 And if it is true, we're going to print it out here. 432 00:20:25,650 --> 00:20:27,530 So far so good? 433 00:20:27,530 --> 00:20:28,880 So I'll make sure to explain it. 434 00:20:28,880 --> 00:20:31,400 So now what I might do, I might come down 435 00:20:31,400 --> 00:20:33,350 and start to work up some pseudo code. 436 00:20:33,350 --> 00:20:35,720 Now, I happen to secretly have the solution 437 00:20:35,720 --> 00:20:39,090 here so that I remember exactly what I need to do. 438 00:20:39,090 --> 00:20:41,690 So I'm going to keep this on the side someplace 439 00:20:41,690 --> 00:20:45,980 so I don't mess up my little thing, because I forget. 440 00:20:45,980 --> 00:20:48,230 When I did this with my class, I actually 441 00:20:48,230 --> 00:20:51,530 forgot that we need to return false if the number is 1. 442 00:20:51,530 --> 00:20:52,520 I forgot that part. 443 00:20:52,520 --> 00:20:54,540 So this way I remember. 444 00:20:54,540 --> 00:20:58,250 So then I might just say, OK, we're going to complete this function. 445 00:20:58,250 --> 00:21:00,200 You take that out. 446 00:21:00,200 --> 00:21:02,630 And then remind them, we're starting. 447 00:21:02,630 --> 00:21:05,810 If the input is 1, what do we know about 1? 448 00:21:05,810 --> 00:21:06,890 Is 1 a prime number? 449 00:21:06,890 --> 00:21:09,080 Do we want to divide something into 1, right? 450 00:21:09,080 --> 00:21:12,350 So we know of the top of our head that 1 is not prime, right? 451 00:21:12,350 --> 00:21:20,090 So I might put something like a check if number number is 1. 452 00:21:20,090 --> 00:21:24,110 If so, return false, something like that, 453 00:21:24,110 --> 00:21:26,505 which is what we're going to actually do over here. 454 00:21:26,505 --> 00:21:28,130 So I'm not going to give them the code. 455 00:21:28,130 --> 00:21:30,740 But I'll put some space on here so that they could actually 456 00:21:30,740 --> 00:21:34,580 then leave the comments in their code as actual comments. 457 00:21:34,580 --> 00:21:37,860 The pseudocode can stay and explain the code below it. 458 00:21:37,860 --> 00:21:40,460 So I might put something like that in here, right? 459 00:21:40,460 --> 00:21:41,630 Then I look at my solution. 460 00:21:41,630 --> 00:21:42,860 What else? 461 00:21:42,860 --> 00:21:45,870 So I need to start dividing everything. 462 00:21:45,870 --> 00:21:49,250 We don't want to divide 1, but from 2 up to but not including 463 00:21:49,250 --> 00:21:50,810 the number itself, right? 464 00:21:50,810 --> 00:21:53,240 We're going to try dividing that into the number that's 465 00:21:53,240 --> 00:21:56,190 given as the arguments appear. 466 00:21:56,190 --> 00:21:59,240 And if it turns out that, using modulo, we 467 00:21:59,240 --> 00:22:04,310 get a 0, that means that there's a remainder, right? 468 00:22:04,310 --> 00:22:05,990 Actually, yeah, if it goes-- 469 00:22:05,990 --> 00:22:08,240 there's no remainder is what I'm trying to say. 470 00:22:08,240 --> 00:22:13,970 If the number i divides into the argument with no remainder, 471 00:22:13,970 --> 00:22:15,370 it means it's a factor, right? 472 00:22:15,370 --> 00:22:16,745 If it's a factor, it's not prime. 473 00:22:16,745 --> 00:22:18,260 We return false. 474 00:22:18,260 --> 00:22:20,280 And then we're going to return true here. 475 00:22:20,280 --> 00:22:24,900 So I might say here something like, OK, so what are we going to do next? 476 00:22:24,900 --> 00:22:27,960 We have to look at every number starting at 2 up to that number. 477 00:22:27,960 --> 00:22:29,330 How do we do that? 478 00:22:29,330 --> 00:22:31,700 Maybe we need to use a loop, right? 479 00:22:31,700 --> 00:22:43,640 So maybe loop from 2 to number, number, not including number, number, right? 480 00:22:43,640 --> 00:22:45,500 So I might say something like that. 481 00:22:45,500 --> 00:22:48,650 And then say, OK when we're looping through it, 482 00:22:48,650 --> 00:22:57,050 we're going to test if i, if we're using i, something like that, 483 00:22:57,050 --> 00:23:03,650 i divides evenly into number, right? 484 00:23:03,650 --> 00:23:11,330 And then something like if so, it's a factor, 485 00:23:11,330 --> 00:23:15,520 return false, right, something like that. 486 00:23:15,520 --> 00:23:20,610 And then I'll say, so how do we know if it's not a factor, right? 487 00:23:20,610 --> 00:23:21,555 So this is actually-- 488 00:23:21,555 --> 00:23:24,180 I might even indent it like this because this is actually going 489 00:23:24,180 --> 00:23:25,722 to be part of my if statement, right? 490 00:23:25,722 --> 00:23:28,450 That's how my code would work. 491 00:23:28,450 --> 00:23:29,713 So then what might I say here? 492 00:23:29,713 --> 00:23:30,630 Who wants to help out? 493 00:23:30,630 --> 00:23:32,790 How would I-- because I would prompt the students. 494 00:23:32,790 --> 00:23:34,950 I want to keep the students involved, right? 495 00:23:34,950 --> 00:23:38,640 So how might I from here, let them know that? 496 00:23:38,640 --> 00:23:42,000 Because one of the things that students will often do, one of the mistakes 497 00:23:42,000 --> 00:23:46,690 might be to return true right over here, right? 498 00:23:46,690 --> 00:23:50,010 If the i didn't-- 499 00:23:50,010 --> 00:23:52,680 it was not a factor, so I'm going to return true, right? 500 00:23:52,680 --> 00:23:55,842 But what happens if I return true right over here? 501 00:23:55,842 --> 00:23:57,300 Does everybody see what I'm saying? 502 00:23:57,300 --> 00:24:02,845 Before the for loop concludes, if I return true, is this going to work? 503 00:24:02,845 --> 00:24:03,720 AUDIENCE: [INAUDIBLE] 504 00:24:03,720 --> 00:24:04,230 MARGARET TANZOSH: What? 505 00:24:04,230 --> 00:24:05,490 AUDIENCE: [INAUDIBLE] 506 00:24:05,490 --> 00:24:06,592 MARGARET TANZOSH: Sorry? 507 00:24:06,592 --> 00:24:14,690 AUDIENCE: [INAUDIBLE] except that [INAUDIBLE] including the [INAUDIBLE].. 508 00:24:14,690 --> 00:24:21,490 [INAUDIBLE] Every number-- 509 00:24:21,490 --> 00:24:22,490 MARGARET TANZOSH: Right. 510 00:24:22,490 --> 00:24:24,950 You need to test every number, you're saying. 511 00:24:24,950 --> 00:24:29,283 AUDIENCE: Every number that [INAUDIBLE] of number is [INAUDIBLE].. 512 00:24:29,283 --> 00:24:31,450 MARGARET TANZOSH: Right, that's right, but it always 513 00:24:31,450 --> 00:24:32,533 ends up being true, right? 514 00:24:32,533 --> 00:24:35,492 Because the first number that doesn't have a remainder, 515 00:24:35,492 --> 00:24:37,450 then you're automatically going to return true. 516 00:24:37,450 --> 00:24:38,750 And we don't want to do that. 517 00:24:38,750 --> 00:24:43,030 So we would want to make sure that we talk about that. 518 00:24:43,030 --> 00:24:45,490 So then we want to say, so this is a loop. 519 00:24:45,490 --> 00:24:55,310 So make sure they understand after loop finishes, if no factor, return false, 520 00:24:55,310 --> 00:24:56,590 something like that. 521 00:24:56,590 --> 00:24:59,230 And so then I'll say, OK, so now figure out 522 00:24:59,230 --> 00:25:02,620 how are you going to actually use the code to do this. 523 00:25:02,620 --> 00:25:03,570 Does that make sense? 524 00:25:03,570 --> 00:25:04,153 AUDIENCE: Yes. 525 00:25:04,153 --> 00:25:05,112 MARGARET TANZOSH: Yeah? 526 00:25:05,112 --> 00:25:07,000 So I would do something like this, right? 527 00:25:07,000 --> 00:25:10,480 And then I'll let them work on it for a little while. 528 00:25:10,480 --> 00:25:12,790 And then see how far they can get. 529 00:25:12,790 --> 00:25:14,470 So then I would turn it over to them. 530 00:25:14,470 --> 00:25:16,790 All right, so see what you can do. 531 00:25:16,790 --> 00:25:18,130 Try to make some sense of it. 532 00:25:18,130 --> 00:25:21,110 Sometimes they still struggle a little bit. 533 00:25:21,110 --> 00:25:22,690 So I might say-- 534 00:25:22,690 --> 00:25:24,850 if I come back, say, for instance, a little while 535 00:25:24,850 --> 00:25:27,740 later, they haven't made too much progress, 536 00:25:27,740 --> 00:25:31,840 I might even say something like, how do I check if this value of number. 537 00:25:31,840 --> 00:25:32,740 Is 1? 538 00:25:32,740 --> 00:25:33,970 How do I check that? 539 00:25:33,970 --> 00:25:35,680 I might want an if statement. 540 00:25:35,680 --> 00:25:41,110 So I might give them the first line of code equals 1. 541 00:25:41,110 --> 00:25:44,650 Then we're just going to put a comment here. 542 00:25:44,650 --> 00:25:48,490 This should be-- should return false. 543 00:25:48,490 --> 00:25:52,960 I might not give them the actual code yet, just a little line at a time, 544 00:25:52,960 --> 00:25:56,970 and then let them take it from there. 545 00:25:56,970 --> 00:26:00,980 So you could see that this is actually a code B, a nested four loop. 546 00:26:00,980 --> 00:26:02,510 You have one four loop here. 547 00:26:02,510 --> 00:26:05,960 And this is actually calling another four loop. 548 00:26:05,960 --> 00:26:10,370 So it might be something that could be useful to prepare students for Mario, 549 00:26:10,370 --> 00:26:13,380 where you're going to have nested four loops. 550 00:26:13,380 --> 00:26:15,320 So what I wanted you guys to do-- 551 00:26:15,320 --> 00:26:20,600 so you'll notice in the printouts and in the agenda over here, 552 00:26:20,600 --> 00:26:22,160 I have three other programs-- 553 00:26:22,160 --> 00:26:26,842 Mario, which would be maybe the one that comes after this, and then Password-- 554 00:26:26,842 --> 00:26:27,800 I'll show you Password. 555 00:26:27,800 --> 00:26:31,850 Password is another practice problem that I created last summer 556 00:26:31,850 --> 00:26:32,960 that students liked. 557 00:26:32,960 --> 00:26:34,790 The video doesn't work here. 558 00:26:34,790 --> 00:26:36,920 The video is actually a really silly video. 559 00:26:36,920 --> 00:26:40,460 It's a clip from a movie, an old movie called 560 00:26:40,460 --> 00:26:46,340 Spaceballs, where there's this person, his daughter is going to be-- 561 00:26:46,340 --> 00:26:50,120 they're going to chop off her nose or something if he doesn't give them 562 00:26:50,120 --> 00:26:52,460 the code for some secret thing. 563 00:26:52,460 --> 00:26:54,572 So they go over-- what's the code? 564 00:26:54,572 --> 00:26:56,030 OK, I'm going to give you the code. 565 00:26:56,030 --> 00:26:57,350 So he gives them the code. 566 00:26:57,350 --> 00:26:59,450 It's 1, and they write it down. 567 00:26:59,450 --> 00:27:01,490 2, and then they write it down. 568 00:27:01,490 --> 00:27:05,540 3, 4, 5. 569 00:27:05,540 --> 00:27:08,460 Oh, OK, so the code is what-- anyway, so it's very silly. 570 00:27:08,460 --> 00:27:11,570 So the whole point is just that it's important to have good passwords. 571 00:27:11,570 --> 00:27:15,383 So the program itself, again, we get a little bit of code 572 00:27:15,383 --> 00:27:17,300 to start with that we'll take a quick look at, 573 00:27:17,300 --> 00:27:20,310 but then I want you to think about how to do this. 574 00:27:20,310 --> 00:27:22,640 So the idea is-- and there's a little demo here 575 00:27:22,640 --> 00:27:27,290 also that I put in these so you can get a sense of how the program should work. 576 00:27:27,290 --> 00:27:30,050 So you're going to enter some password, but you 577 00:27:30,050 --> 00:27:34,940 need to check that the password has one uppercase letter, a lowercase letter, 578 00:27:34,940 --> 00:27:37,110 a number, and a symbol. 579 00:27:37,110 --> 00:27:39,740 So this program was really helpful to prepare students 580 00:27:39,740 --> 00:27:45,650 for readability, where they had to now use the ctype library to count letters, 581 00:27:45,650 --> 00:27:52,550 to count spaces, and to count certain punctuation. 582 00:27:52,550 --> 00:27:56,810 So this was what I did just before I got to readability. 583 00:27:56,810 --> 00:27:59,120 So here you can see we're trying it a few times. 584 00:27:59,120 --> 00:28:00,450 That's how it's going to work. 585 00:28:00,450 --> 00:28:04,100 So I'll take, again, the distro code, but I'm not going to work-- 586 00:28:04,100 --> 00:28:06,050 I'm going to let you work on these three. 587 00:28:06,050 --> 00:28:09,140 And I'm available to come around and if you have questions. 588 00:28:09,140 --> 00:28:13,570 But let me just open my terminal-- 589 00:28:13,570 --> 00:28:15,030 sorry. 590 00:28:15,030 --> 00:28:19,550 Oh, gosh, too many things going on here. 591 00:28:19,550 --> 00:28:20,367 There it is, OK. 592 00:28:20,367 --> 00:28:24,570 593 00:28:24,570 --> 00:28:27,660 Password-- all right, so password, so again, 594 00:28:27,660 --> 00:28:31,770 we have a function that we're completing to give students ideas with functions. 595 00:28:31,770 --> 00:28:34,470 We already get-- the get string is given to us. 596 00:28:34,470 --> 00:28:37,320 Enter a password, and then we're just executing again 597 00:28:37,320 --> 00:28:41,370 another Boolean function to say if valid password, in other words if it 598 00:28:41,370 --> 00:28:45,460 returns true, your password is valid, else-- it returns false. 599 00:28:45,460 --> 00:28:51,510 So the idea is and the problem spec, we can come back here. 600 00:28:51,510 --> 00:28:53,550 There's some implementation details. 601 00:28:53,550 --> 00:28:57,870 And it's a lot of detail here already that you could-- 602 00:28:57,870 --> 00:28:59,610 how you have to find everything out. 603 00:28:59,610 --> 00:29:03,630 And there's a check 50 here, not a submit 50. 604 00:29:03,630 --> 00:29:07,395 But you can choose to use it however you want. 605 00:29:07,395 --> 00:29:10,150 606 00:29:10,150 --> 00:29:12,360 So I give them a big hint over here. 607 00:29:12,360 --> 00:29:17,670 You might want to create a Boolean value for each condition, set it to false 608 00:29:17,670 --> 00:29:19,620 before you start iterating through the string. 609 00:29:19,620 --> 00:29:22,470 Because again, here we have an iteration through a string, 610 00:29:22,470 --> 00:29:26,340 which you need to do for readability as well and eventually for Caesar. 611 00:29:26,340 --> 00:29:28,650 And if you find that the number-- if you find a number, 612 00:29:28,650 --> 00:29:30,840 you set that Boolean to true. 613 00:29:30,840 --> 00:29:33,210 If all the Booleans are true at the end of the function, 614 00:29:33,210 --> 00:29:37,480 then all the criteria are met, the function would return true. 615 00:29:37,480 --> 00:29:41,760 So again, what I'm going to do now is turn it over to you 616 00:29:41,760 --> 00:29:46,167 and say, on your laptop, if you have a laptop, or if you don't have a laptop, 617 00:29:46,167 --> 00:29:48,000 you could write it on paper, I want you to-- 618 00:29:48,000 --> 00:29:51,660 rather than moving upstairs, which takes too much time, we'll lose all of it-- 619 00:29:51,660 --> 00:29:55,350 work with the group around you, the partner next to you or behind you, 620 00:29:55,350 --> 00:29:59,790 as much as you can, and together figure out how to scaffold this. 621 00:29:59,790 --> 00:30:01,540 You could talk to each other. 622 00:30:01,540 --> 00:30:03,150 You could even prompt each other. 623 00:30:03,150 --> 00:30:05,340 How do I create a Boolean variable? 624 00:30:05,340 --> 00:30:06,430 How about I do this? 625 00:30:06,430 --> 00:30:08,910 Let's put in some comments first, like that we're 626 00:30:08,910 --> 00:30:10,530 going to create these variables. 627 00:30:10,530 --> 00:30:12,780 You can even start to do a little coding together. 628 00:30:12,780 --> 00:30:14,850 But just start out with some pseudocode. 629 00:30:14,850 --> 00:30:15,870 How would I do that? 630 00:30:15,870 --> 00:30:18,837 I might need to define some Boolean variable, maybe set it to false. 631 00:30:18,837 --> 00:30:20,670 And you can put that in pseudocode to start. 632 00:30:20,670 --> 00:30:21,660 Question? 633 00:30:21,660 --> 00:30:22,570 You're good? 634 00:30:22,570 --> 00:30:23,610 OK, good. 635 00:30:23,610 --> 00:30:26,387 All right, does everybody know what to do? 636 00:30:26,387 --> 00:30:26,970 AUDIENCE: Yes. 637 00:30:26,970 --> 00:30:29,637 MARGARET TANZOSH: OK, good, so I'm going to turn it over to you. 638 00:30:29,637 --> 00:30:32,850 And then we can come back and we'll take, I guess-- 639 00:30:32,850 --> 00:30:36,127 I've totally lost track of the time, but we'll take a little bit of time, 640 00:30:36,127 --> 00:30:38,460 and I'll give you some time, and then we'll take a look, 641 00:30:38,460 --> 00:30:39,710 and we'll go over it together. 642 00:30:39,710 --> 00:30:40,320 OK? 643 00:30:40,320 --> 00:30:41,010 OK, good. 644 00:30:41,010 --> 00:30:45,410 645 00:30:45,410 --> 00:30:47,570 All right, so let's bring it back together. 646 00:30:47,570 --> 00:30:49,940 I just typed in some sample pseudocode that I 647 00:30:49,940 --> 00:30:52,460 did with my own students, something like this. 648 00:30:52,460 --> 00:30:55,490 So I'm not going to give them all the code up front. 649 00:30:55,490 --> 00:30:57,350 The idea is that I want to work with them. 650 00:30:57,350 --> 00:30:59,100 I don't want to just tell them what to do. 651 00:30:59,100 --> 00:31:00,560 I want to keep them involved. 652 00:31:00,560 --> 00:31:03,320 And I want to just ask them, how do I get started? 653 00:31:03,320 --> 00:31:04,500 And then they don't know. 654 00:31:04,500 --> 00:31:07,460 So I might say, well, the problem spec-- and I might go back and even 655 00:31:07,460 --> 00:31:11,210 refer to it because I want them to also get used to reading the hints 656 00:31:11,210 --> 00:31:13,880 and reading the problem specification. 657 00:31:13,880 --> 00:31:17,000 All right, so over here it gives us some nice hints. 658 00:31:17,000 --> 00:31:20,480 We might want to create a Boolean variable for each upper, lower, 659 00:31:20,480 --> 00:31:23,670 whatever, and set it to false before you iterate through the string. 660 00:31:23,670 --> 00:31:26,180 So if I might say, great, that's how we're going to start. 661 00:31:26,180 --> 00:31:28,280 So maybe the first thing you're going to do 662 00:31:28,280 --> 00:31:32,160 is you're going to declare a Boolean variable has upper, set it to false. 663 00:31:32,160 --> 00:31:34,670 And then I put the comment there. 664 00:31:34,670 --> 00:31:36,510 I don't give them the code yet. 665 00:31:36,510 --> 00:31:39,720 I'm just releasing a little more information each time. 666 00:31:39,720 --> 00:31:42,890 All right, then I create a Boolean variable for has lower. 667 00:31:42,890 --> 00:31:46,610 Then maybe eventually I'll say iterate through the string password. 668 00:31:46,610 --> 00:31:48,620 How do we iterate through a string? 669 00:31:48,620 --> 00:31:51,470 And then someone might say we use a loop. 670 00:31:51,470 --> 00:31:53,270 Great, so you're going to use a loop. 671 00:31:53,270 --> 00:31:54,680 We've looked at loops before. 672 00:31:54,680 --> 00:31:56,250 You could watch the lecture video. 673 00:31:56,250 --> 00:31:58,880 We always have lots of examples of iterating through strings. 674 00:31:58,880 --> 00:32:03,050 Iterate through a string, and let's look at one character at a time. 675 00:32:03,050 --> 00:32:07,220 All right, then you're going to use the ctype library. 676 00:32:07,220 --> 00:32:09,360 You might want to include that on top. 677 00:32:09,360 --> 00:32:12,307 So the ctype library has a lot of really great functions. 678 00:32:12,307 --> 00:32:14,390 And you might want to use these for other programs 679 00:32:14,390 --> 00:32:16,140 as well, like when you get to readability. 680 00:32:16,140 --> 00:32:17,840 I would give them hints. 681 00:32:17,840 --> 00:32:20,300 And then if the password has a letter in it, 682 00:32:20,300 --> 00:32:24,530 like password square bracket IS uppercase, set has upper to true. 683 00:32:24,530 --> 00:32:25,860 I might not even finish this. 684 00:32:25,860 --> 00:32:27,650 I might just get them going like this. 685 00:32:27,650 --> 00:32:34,970 And then I might say at some point something like dot, 686 00:32:34,970 --> 00:32:38,160 dot, dot, like they can figure it out for themselves. 687 00:32:38,160 --> 00:32:43,940 And then maybe we want to put something like if all Booleans-- 688 00:32:43,940 --> 00:32:48,940 Booleans are true, then what does that mean? 689 00:32:48,940 --> 00:32:49,820 AUDIENCE: [INAUDIBLE] 690 00:32:49,820 --> 00:32:52,550 MARGARET TANZOSH: Right, so we're going to return true. 691 00:32:52,550 --> 00:32:58,428 And then do I want to put that in four loop or not in four loop? 692 00:32:58,428 --> 00:32:59,720 I might ask them that question. 693 00:32:59,720 --> 00:33:02,750 AUDIENCE: [INAUDIBLE] 694 00:33:02,750 --> 00:33:05,000 MARGARET TANZOSH: Well, if I find the first four 695 00:33:05,000 --> 00:33:09,530 letters is a letter an uppercase, a lowercase, a symbol, and a digit, 696 00:33:09,530 --> 00:33:12,440 do I still really want to go through the rest of the password? 697 00:33:12,440 --> 00:33:13,187 AUDIENCE: Yes. 698 00:33:13,187 --> 00:33:14,270 MARGARET TANZOSH: But why? 699 00:33:14,270 --> 00:33:16,160 Because we already know it has everything we need. 700 00:33:16,160 --> 00:33:17,030 AUDIENCE: [INAUDIBLE] 701 00:33:17,030 --> 00:33:20,280 MARGARET TANZOSH: All right, so we might want to short circuit the whole check 702 00:33:20,280 --> 00:33:23,270 and say, great, as soon as I find all four things are true, 703 00:33:23,270 --> 00:33:25,250 I can return true right away. 704 00:33:25,250 --> 00:33:26,850 I don't need to waste any more time. 705 00:33:26,850 --> 00:33:30,050 So I might give them those hints also, which are a little bit about design. 706 00:33:30,050 --> 00:33:34,280 Like if you have some kind of function and we know that function is good. 707 00:33:34,280 --> 00:33:37,640 Like if you're doing a linear search function, as soon as you find the match 708 00:33:37,640 --> 00:33:39,120 you can return true right away. 709 00:33:39,120 --> 00:33:40,430 You don't need to continue. 710 00:33:40,430 --> 00:33:44,390 And then maybe where are we going to actually know it's not valid? 711 00:33:44,390 --> 00:33:46,590 Do we want to do it inside the loop? 712 00:33:46,590 --> 00:33:51,082 So maybe we want to stress maybe after loop, loop not valid. 713 00:33:51,082 --> 00:33:53,040 So they could figure out what to do from there. 714 00:33:53,040 --> 00:33:56,630 So I'm going to actually say that's basically-- 715 00:33:56,630 --> 00:33:58,610 I'm hoping that you got something out of this. 716 00:33:58,610 --> 00:34:00,740 The idea is really just to get a little idea 717 00:34:00,740 --> 00:34:04,295 of how to get started scaffolding for students. 718 00:34:04,295 --> 00:34:05,670 You don't have to do it this way. 719 00:34:05,670 --> 00:34:06,890 This is just what I do. 720 00:34:06,890 --> 00:34:08,630 My students really like this. 721 00:34:08,630 --> 00:34:12,110 And I have to be careful with them because then sometimes they'll say, 722 00:34:12,110 --> 00:34:14,330 just give me the pseudocode up front. 723 00:34:14,330 --> 00:34:16,040 And it's like, no, no, no, no, no. 724 00:34:16,040 --> 00:34:19,010 I want you to work on it for a while, and then when you have questions, 725 00:34:19,010 --> 00:34:20,385 then we'll do a little at a time. 726 00:34:20,385 --> 00:34:21,757 All right, so thank you so much. 727 00:34:21,757 --> 00:34:23,840 I'm going to turn it back over to Professor Malan. 728 00:34:23,840 --> 00:34:24,935 DAVID MALAN: Thank you. 729 00:34:24,935 --> 00:34:27,210 MARGARET TANZOSH: And it was really great working with you. 730 00:34:27,210 --> 00:34:28,168 DAVID MALAN: Thank you. 731 00:34:28,168 --> 00:34:31,099 [APPLAUSE] 732 00:34:31,099 --> 00:34:32,000