Matt Sparks

A web developer trying to learn stuff…

Read this first

Matt Learns Python: Part 2 - More Strings, Variables, and Math!

The goal of this blog is to document my journey learning new things in the world of web development and programming. At the same time, I hope to help others learn as well. Feel free to say hello on Twitter!

Previous Post: Part 1 - Getting Started

In the last post (linked above) we got Python up and running and wrote our first script. That was great and I enjoyed our time together. While printing quotes from The Matrix is awesome, it’s time to move on. Ok, one more quote.

You have to let it all go, Neo. Fear, doubt, and disbelief. Free your mind.

Words to live by, huh? Anyway, before we get started with strings and such I want to introduce you to the Python Command-Line Interpreter. You’ve seen it before, actually. Remember how we ran our first script?

python example1.py

Well, this time we’re going to just type python with no file afterwards.

python

You should see something like...

Continue reading →


Matt Learns Python: Part 1 - Getting Started

The goal of this blog is to document my journey learning new things in the world of web development and programming. At the same time, I hope to help others learn as well. Feel free to say hello on Twitter!

A friend of mine had been urging me to take a look at Python for awhile. Specifically, he told me about Django, a web framework written in Python, and how great it was. After awhile of giving excuses, I relented and dug in. I’m glad I did.

Before we get started I want to share with you The Zen of Python:

The Zen of Python

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren’t special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly...

Continue reading →