Sample Video Frame

Created by Zed A. Shaw Updated 2026-09-08 23:25:25
 

Exercise 4: Dealing with Command Line Arguments

Before you can work on this first part of the book you need to do some quick hacking that teaches you about command line arguments in Python.

Traditionally we call this kind of hacking a "spike". The term comes from doing a small test project that covers all of the elements of a larger process or project. This little test hack "spikes" through everything to make sure you can use it. The purpose of a spike is to figure out how to use some new library or tool in a dress rehearsal before you sit down to really use it in your project.

This is also the first exercise that has the "Challenge Format". The Challenge Format is designed to make you figure out how to do something, and then you can come and see how I did it compared to your work. I don't give you the code first and have you type it in. Nope, that's for beginners and you're no longer a beginner. You are now reading a challenge and then you have to solve it.

WARNING: Read this very carefully! You are not expected to complete a fully working publishable piece of software in 45 minutes. The 45 minute time limit is to make you get going and stop worrying that you'll do it wrong. It's a push to make you work and not intended as a test. This means that if you look at the 45 minute time frame and then freeze because you think you can't get a monumental piece of beauty completed you are doing this wrong. You should look at this as, "Let's see what I can get done in 45 minutes." These exercises are open ended because different people will complete different amounts of work in the given time. You are simply using the time constraint to figure out how you work, not to figure out if you are a terrible programmer or a great one.

Previous Lesson Next Lesson

Register for Learn More Python the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.