<p>Day 5: More Python </p>
Back to Blog

Day 5: More Python

Tonight I’ve been teaching myself more about Python and the many things it can do. The first thing I worked on was just writing a quick linked list program to reacquainted with the language and the data structure. I got it working with just a few glances at stack overflow, mostly because I haven’t looked at it in a long time.

After I got that working, I wanted to try to copy what we do at work and at least be able to take in some data with options in the command line and manipulate it. I worked with the same data that I used yesterday, took in a file name and printed out the total years, the total number of houses and the total number of houses with two beds or less (in thousands). I haven’t used the OptionParser class before, but it’s super easy to learn and a really simple way to read in command line options and arguments.

I taught myself about generators tonight, reading stack overflow and other sites to learn more about the yield command and what it does. I thought that this stack overflow question and the answers were pretty helpful.

I also tested out a lot of commands with sets and sorted to see how they work and I can use the functions in the future for data stuff. I know a fair amount of Python from school and work, but I really wanted to learn more about what the best way to do things is - what’s the most efficient, fast, useful for what I want to do. Over the past 2 days I’ve taught myself a lot about Python - I think that unpacking argument lists is really cool, and the built in set function would be super fast for indexing or sorting a list uniquely.

I put the code I wrote today on GitHub:

Linked List

Practicing with data files

Claudia | Blog
Hey There!
What is This?