At the Introduction to Python course we solve small assignments. Each week we have a new area of focus.
This week we worked with comprehensions. We used list, set, tuple and dictionary comprehension. We also used the decorators from last week to find out if comprehension actually is faster than a normal for loop
This week we worked with using and creating our own decoratores. We solved exercises we're we had to create decorators. We created decorators that could do the following:
- log the time the function was called and which arguments were passed
- slow down the execution of a function
- measure the time of a functions execution
- measure the memory usage of a function
We worked with pythons built-in methods, and created our own implementation of those. We also created our own linked list as Python doesn't have one. We also built some of the functionality to a game, so to get it working, we needed to create a class and implement methods such as:
- len
- eq
- add
- str
- sub
- iter
As an extension to OOP we now had to work with encapsulation. We made our variables private and used Properties to get and set the values. We did a few exercises to test our knowledge
This week we had about using Object Oriented Programming with python. We learned how to use classes and inheritance. We made a few exercises where we had to use OOP
This week we worked on getting to know some of pythons different modules. We built a script which can clone all the repositories of a github user into a folder locally on the computer. We also built a web crawler which should be able to download the entire content of a webpage, and get it to work locally. We worked with the modules:
- os
- subprocess
- requests
- and we created our own module and imported it
This week we had about the different data structures (lists, dictionaries and tuples). We also worked with opening and closing files, and we made some functions which could read the content of a file into a dictionary and be able to sort them depending on how many times it had been in the text.
The first week we learned about strings (splitting, concatenating, joining etc.) and worked on getting a better understanding of the command line and unix commands