Crash Course Python

Last week I was sent a code challenge that had to be completed using SQL and Python. It involved a SQL query, a test in Python to see if an IP address was valid, and a query to an external API using Python. All of that is pretty standard, except I had never used Python before. I was excited about this challenge because Python is a language that I have really wanted to learn for a while, and the challenge was sent with the full awareness of my lack of Python knowledge and they wanted to test my resourcefulness. That’s exactly the kind of challenge I love.

Between finding out what the challenge would involve and beginning it, I sped through Code School’s first Python tutorial and grasped the basics of syntax(i.e. whitespace), lists, and dictionaries. I was relieved by how quickly I was able to pick it up. Python is so fundamentally similar to Ruby; it’s the syntax (mainly the use of whitespace/indentation to mark the end of a loop or function) that feels like the major difference (at least so far). While I have strong feelings about maintaining clear indentation in my Ruby code, I still feel like denoting the end of a loop or function with ‘end’ is much more clear.

That said, it is already clear to me how much better Python is for working with data. The Counter library (and the fact that the challenge itself allowed me to import that library) made sorting the output of my API query  (which was a requirement) so much easier. More than once I found that I was able to import a library for handling data that saved me several loops of my own, and I was able to use them immediately.

It took me more time to complete this challenge in Python than it would have in Ruby because I kept having to Google things that I was second-guessing myself on, but it forced me to get further in less than a day in Python than I had in a week of Ruby, which was my first language.

Leave a comment