Helen Chong

Navigation Links:

Back to posts

CS50x Week 9 Completed

At last, on 5 March 2024, I completed Week 9 of the CS50's Introduction to Computer Science (CS50x) course, by submitting my solutions to Problem Set 9 . In other words, I have finished all assignments for the CS50x course, with the only thing left for me to do to complete the course is building and submitting my own final project.

Problem Set 9 consisted of two problems, Birthdays and Finance, which required Python, Flask and SQL to solve. I did and submitted my solution to the Birthdays problem on 6 January 2024. At the time, I already took a break from the CS50x course for a few months to pursue other front-end web development courses. It was rather challenging to go back to CS50x and do its assignments after taking a break from the course for a while. My SQL and Flask knowledge got rusty due to rarely using them.

On 2 March 2024, I began tackling the Finance problem. As the final assignment for the course before the final project, Finance was by far the largest assignment of CS50x. As I expected, this project challenged me to apply everything I learned from the CS50x course. I needed to refer to my solutions to the previous problems to refresh my skills of Python, Flask and SQL. Thankfully, I had a good start; on my first day doing the Finance problem, I successfully implemented the Register and Quote features.

The next day, I started implementing the feature to buy stocks by setting up and testing input elements. After a lot of research and trial and errors, I learned to use try...except to display an error message on the web page if an incorrect input is entered. I also learned to make use of the phpLiteAdmin installed in the CS50 Codespace to work on the project’s database and get the SQL commands I want to use, and modify the database in a graphical user interface.

On the third day of me doing the Finance problem, I successfully implemented the features to buy stocks and displaying the user’s owned stocks on the index page. My work on this project allowed me to refresh my knowledge and skills of SQL, by creating new tables, inserting new rows into tables, and updating data of existing tables. I also got more practice in working with Flask by dynamically render HTML elements via Python.

On 5 March 2024, I successfully implemented not only the last required features to sell stocks and display transaction history, but also additional features, namely to add cash to the user’s account and change the user’s password. On my last day working on the Finance assignment specifically, I learned about:

  • Set the timestamp based on local time zone in SQL
  • The flash message function in Flask
  • Use both the round() and float() functions to round a number to a certain amount of decimals
  • The steps attribute of HTML’s <select> element

Finally, I completed and submitted the Finance problem from Week 9 of CS50’s Introduction to Computer Science!

Here is a video demonstration of my completed Finance project:

Working on this assignment allowed me to practice and learn SQL, Python and Flask a lot. By finishing Week 9 of the CS50x, I reached another milestone.