This week is a relatively chill week; you talk about List Comprehensions and the any
and all
functions in Python, and how they can be used to make your code more readable and concise.
This week, Practice Problem II Q3 is a homework problem since we weren't able to get to it. While not required, it is highly recommended that you attempt it.
You are also invited to play around with the songs
list in solutions.py and see if you can come up with your own list comprehensions to achieve your own goals. Here are a few:
- Filter songs based on popularity (Must fall in a certain range)
- Filter songs based on genre
- Filter songs based on artist
- Filter songs based on whether they have a prime number of words in their title
Solutions to the practice problems can be found in solutions.py.
All solutions provided are provided outside of FSG hours, and are not endorsed neither by the UTM RGASC nor the CSC148H5 Course Staff. These solutions are meant to be used as a reference, and not a replacement for the problem solving process. Use at your own risk. You are encouraged to attend office hours and ask questions during lectures if there are any parts of the solution that you do not understand. Should you find anything that is incorrect, please open an issue on this repository and I will address it as soon as possible.
The file provided in spotify_scraper.py is a simple script that scrapes a song and its metadata from an arbitrary Spotify Playlist. It's completely out of the scope of CSC148, and not required for the FSG. I just thought it would be a fun script to include if anyone was curious how I generated the songs used in solutions.py