CS50 is a first year university course offered by Harvard University and more recently, Yale University, which dives into the basics of computer science, exploring algorithmic thinking and teaching students how to code in a variety of languages including Scratch, C, and Python, amongst others. In the last few weeks of the course, it offers a choice of three tracks - game, web, or mobile development that students can explore and create their final project which is encouraged to be something which is useful beyond the course.
The online course which is known as CS50x offers a stripped down experience of the real course. The assignments, known as problem sets (or psets), are marked against certain criteria and a number of test cases by an automated program. All of your coursework is pushed into individual branches of your own CS50 GitHub repository. I've copied these branches into a single repository for ease of perusal, which can be found here.
Week 6 brought the introduction of Python and problems that were somewhat easier to solve due to the looser typing. The majority of this week's problems were recaps of programs that I wrote in C in the first 3 weeks of the course. Mostly, I just copied the logic from my C implementation to Python with differences where Python does not have switch statements and a few other features.
The only new problem that was introduced here was a DNA sequencing program. Essentially it takes a CSV with the values of different Short Tandem Repeats (STR) present in each person's DNA. These are strings such as AGAT with the value representing the number of times in a row this STR is repeated - e.g. "AGAT": 3 would be AGATAGATAGAT.
Apparently the exact number of these various STRs repeated throughout a person's DNA are a good way to identify DNA samples based on a person's sequenced DNA. All this sounds pretty complex but for the most part, the problem was able to be solved with Regex that matched the STR a number of times - value times, to be exact. I did run into a few edge cases as CS50 is really good at throwing these sorts of curveballs at you when you think you're being clever with your solution so I did have to find a way to manage this.
The image below shows the program in action - it's obviously not particularly exciting to look at on the surface, but working around the problem with Regex was a fun experience, even if I already use Regex frequently in my day job.
Similarly to this week, Week 7 tackles a subject matter I'm already fairly familiar with - SQL databases. The week after that will split out into separate tracks - game, app, or web development - at this point, it's likely that I'll go with app development if I can get my MacBook to cooperate for long enough to install Xcode.