Review: CS50 A Taste of Python

This weekend, I attended one of the new CS50’s New Year’s Seminars, “A Taste of Python”. I had never worked in Python prior to this, so I was excited to get my first “taste” of a new language (new, for me).

We began, of course, with ‘hello, world!’.

print("hello, world!")

So, friendly! So far, so good. The course was taught by Brian Yu, and there were an unbelievable 1,000 participants on the zoom call, with another estimated 1,000 more following on YouTube, and even more following on FaceBook.

Given the large number of participants, it was delightfully surprising to see how well the group was able to communicate, that there were very productive comments in the chat, and that the instructor was able to interact with the participants so easily. Many questions that were posted, were read, and answered quickly by Brian Yu, which was quite amazing given the large number of posts scrolling the chat so quickly.

So, in addition to building a small “hello, world”, program, we went through input, converting strings to integers, simple arithmetic, conditional statements (if, elif, else), variables, loops, sum of array, random, and then were able to write a few simple programs, including, appropriately, a Countdown to Happy New Year.

The course lasted about three hours, and went at a pace that was comfortable for someone with at least a basic background in some programming. But, perhaps too quickly for anyone who had no prior coding experience. And left us with two further ‘homework’ assignments to complete on our own. Here are my solutions to the homework problems.

First we were to write a program that asks the user to type in a number n, and then prints a pyramid of hash marks of height n, like the pyramid in Mario. This was my solution

which produces this output, when run:

The second assignment is to write a program, called Cash, that asks the user to type in an amount of money and prints the minimum number of US coins (quarters, dimes, nickels and pennies)required to make change.

This was a pretty fun introduction to Python, and from a JavaScript background, I was easily able to learn the basics. I am going to dive deeper and create a more complex project, and will blog again about Python!

Full Stack Developer | Software Engineer | React | Ruby on Rails | Musician | Artist | Educator