It was unfortunately a pretty “meh” week for me on KA. I made it through the second unit of CS, Designing Algorithms with Conditionals, which was simple since I only had one thing left to do, but then I only made it about halfway through the following unit, Unit 3, Simulating Phenomena with Loops. Not to make excuses, but I was getting my butt kicked this week by spring allergies and didn’t have it in me to put as much time and energy into KA as I would have liked to. BUT, I still managed to get a decent amount of work done, so I’ve got that going for me which is nice. One interesting/concerning thing was that I found the last challenge I did at the end of the week very difficult. Up until now, everything I’ve worked through has seemed completely obvious and simple to follow. (I was starting to think I was a CS genius!) The challenge I worked through at the end of the week used a bunch of variables and loops in a math-y type of way and I was struggling to understand the logic. I’m hoping that this type of programming will get easier/more intuitive the more I keep doing it because I was pretty overwhelmed and frustrated by that challenge. 👎🏼 Nonetheless, it was still a decent week overall and I’m happy with the effort I put in, especially considering I could barely breath! 🤧
As I mentioned, I only had one last thing left to do in Designing Algorithms with Conditionals which was what’s called a “project” which is pretty much the same thing as a challenge:
Unit 2 – Designing Algorithms with Conditionals
Lesson 5 – Project: Recommendation Engine



I started this project by asking CGPT to give me ideas for writing a travel recommendation program and then got started writing code. I also asked Gemini for help and it suggested I use what’s called a “dictionary” which is a tool used in Python. I did and it “worked”, but then I realized I was missing the point of learning how to use if-elif-else conditionals by using the dictionary, so I asked Gemini again how I could rewrite the program using i-e-e conditionals and it led to me writing out the code you see in the first two screenshots above.
Overall, this project was really helpful practice for me to learn how to use i-e-e conditionals. And as a side note, you can see in the third screenshot above how to “complete” the project, you just fill out a self-report questionnaire. I mentioned in my last post that I really don’t like this method. This sounds very entitled, but I’d much prefer if KA would TELL me whether or not I did it correctly.
After I finished that project, I got started on the following unit, Unit 3, Simulating Phenomena with Loops. Here are some notes from the second video from that unit:
Unit 3 – Simulating Phenomena with Loops
Lesson 1 – Video: Importing Modules



This video talked about what are known as “modules”. In the CS50 videos I’ve been watching, in language I learned about called C, it uses the exact same thing as a module but in C they’re called “libraries”. Both modules and libraries are packages of functions that you can download and import to your program which then allows you to use the functions they include. Here’s an example of a module that was in an article I read:


I should also mention that Python has what’s called “built-in” modules which you don’t need to download but are nonetheless available to be imported. (I’m not 100% sure if what I just wrote is true/accurate. I’m a bit confused by the whole thing but it’s something like that.) The screenshot above shows that the program imported the “random” module which has functions within it that, among other things, you can use to get the computer to pick a random integer. These modules are different from built-in functions like print() and in() because you HAVE to import them at the top of your program in order to access their functions. Google said the reason why modules are not permanently available is because they take up memory and most programs don’t need EVERY function, so it’s unnecessary to have them permanently built-in to Python.
Here’s the challenge I worked through that helped me learn about modules:
Lesson 1 – Challenge: Avatar Generator





This challenge took me ~15 minutes to finish. The second screenshot shows what’s in the module avatar.py. Adding in the random module and using it’s function random.randomint() was simple enough. All the steps were pretty straightforward except for the last step where it asked me to move the bow-tie above or below, or remove it entirely based on randint(1, 3). I wasn’t sure what to do so I put:
- if bow_tie = 1:
- avatar draw_bow
- […the rest of the code…]
- if bow_tie = 2:
- avatar draw_bow
And this way of formatting the code implied that if randint = 3, no bow tie would be drawn. I’ll also mention that I find it SUPER annoying that they don’t show me how THEY would code the program. I feel like they should at least show you how they’d do it at the END of the program so I could compare to see if I could have made my code more efficient in some way.
The next lesson in the unit was all about what’s called “loops”. Here are some notes I made on the second video from that lesson:
Lesson 2 – Video: Tracing Loop Execution

In this video, Kim went through the program in the screenshot above step by step to explain how the “while” loop works. Before the video started, I paused it and was able to think through how/why the while loop worked which I found helpful to do ahead of time. In essence, the way it works is: 1) pin = “” is an empty string, 2) while len(pin) = 4 measures the number of characters in pin and runs the loop until the number of characters equals 4, 3) digit = random.randint(0, 9) gets a random integer, 4) pin = pin + str(digit) turns the digit into a string and adds it to/into “pin”, then the loop runs the entire thing back again until there are 4 digits (i.e. characters) in the pin.
One word Kim said that helped me understand loops better was the word “bottom”. I’d seen loops being used in CS50 videos before in C but I found them confusing not understanding how the program knew to keep executing code until a certain point. For whatever reason, hearing Kim say the computer gets to the “bottom” of the loop and then loops back to the top helped make it clearer. 🤷🏻♂️
Here are two questions from the exercise in this lesson:
Lesson 2 – Exercise: Trace While Loops
Question 1



Question 2


This questions in this exercise were pretty straightforward. I got all four correct in a row with each question taking me ~1 minute to answer. But it was still helpful!
Here’s the challenge I worked through from this lesson:
Lesson 2 – Challenge: Dice Rolls

(INSERT SCREENSHOT)



I found this challenge a bit tricky. I couldn’t figure out the first step (which was the second screenshot above), that I had to put all the variables inside the loop. Before I figured it out, it would just print the same number 10 times in a row (i.e. “You rolled a ‘x’!” x10). At the end, I asked Gemini if I could make it better and it suggested I added a while loop to make sure the user input was a number greater-than 0, which you can see I did in the last screenshot above.
The next lesson was all about what’s called “for” loops. Here are some notes I made from the first vid:
Lesson 3 – Video: For Loops with range()

This video introduced this type of loop explaining that it essentially does the same thing as a while loop but stays within a specific range. Kim said that, “all for loops can be written as while loops, but not all while loops can be written as for loops.” I believe this is because while loops can end/be terminated at an undetermined time (for example, when a random integer is chosen or after a a user inputs something specific), whereas a for loop has a hard limit (so to speak), i.e. a specific and predetermined number of loops/iterations.
Here are a few questions I worked through from the exercise in this lesson:
Lesson 3 – Exercise: Trace For Loops with Range
Question 3



This question took me ~5 minutes to think thorugh. I was fairly sure that a) and b) were incorrect because I was pretty sure that the donations.mark_spreadsheet() functions would also need to be indented so that it would execute each time the loop looped. The reason why I went with d) was because it didn’t make sense to me that c) had a variable ‘i’ in it (for i in range…) that hadn’t been declared. However, part of me thinks that the way c) was written with ‘i’ could actually be correct, but I’m not sure…
Question 4


I got this question wrong. 😔 For some dumb reason I thought d) was the solution and that the loop would run 4 times leading to 4 words. I was not thinking clearly because even if that were true, len(doo.) = 4 >= 2, so the output would have been doo.wop.wop.wop = c). What I also didn’t realize was that even when the double-indented line of code executes, the single indented line (song = song + “doo.”) ALSO still executes. So, I got this question wrong for multiple reasons. 😒
The last thing I got through this week was the challenge from this lesson:
Lesson 3 – Challenge: Wait Times




I found this challenge VERY difficult. I was having a hard time simply understanding what the steps were asking me to do, and then trying to understand how to use the min() and max() functions with the different variables was SUPER confusing. Unlike math where the variables were usually things like x, y, a, b, c, etc. (i.e. individual characters), I found using the variables in this program that were written as words SUPER challenging and hard to follow along with. I had to get Gemini’s help with the third step as I couldn’t figure out how to setup the equation for that step. I’m hoping that the more challenges and projects I do like this, the easier and more intuitive this type of logic and these types of equations will be for me… 🙏🏼
And that was it was for this week. The good news is that my spring allergies seem to be getting better so I’m hoping I can hamate some decent progress this upcoming week. I have two lessons left to get through in the current unit I’m in, and there are five lessons in the following unit, Unit 4, Playing Games with Functions, so I’m hoping I can get through both units this upcoming week in order to get back to the one-unit-per-week pace I was hoping to have. So, as always, fingers crossed I can have a productive week and make it happen! 🤞🏼