How to Write a Python Program

Joseph Mellor
16 min readMar 9, 2023

Knowing what the tools do is necessary to write a program, but you also need to know how to structure a program.

Image made by me using the python logo, cool-retro-term, vim, the onedark color scheme, and GIMP.

If you’ve kept up with this series, you should have python installed, you should understand the core operators of python, you should know how to control the flow of a program, you should know how to handle files, and you should know how to get other libraries into your program. In this article, we’re going to use everything we learned up to this point to write a program to test the Zipf Hypothesis.

While there’s plenty of articles about data analysis, I want to focus on how we can do anything by breaking a major task into smaller tasks.

Breaking a Big Task into Smaller Tasks

Right now, we have a big task: test the Zipf Hypothesis on some data. Unless you know the exact code to write for this task, you’re going to have to break this task into smaller tasks. To figure out how to break these tasks apart, I ask myself the following questions:

Outputs

  • What information do I want?
  • How should I format the information I want?
  • What do I need to know to get this…

--

--

Joseph Mellor

BS in Physics, Math, and CS with a minor in High-Performance Computing. You can find all my articles at https://josephmellor.xyz/articles/.