PYTHON FOR BEGINNERS
By Becca Gates
Ever been told you should learn how to code? According to tons of online articles, it’s the new fresh way to get a leg up in the job market for those that are outside of the engineering or computer science sectors. As a humanities student, I always wanted to learn some coding basics to expand my range of skills. I decided to learn the coding language Python, but starting out proved more intimidating than expected.
I attempted to navigate the swirling masses of tutorials, guides, and forums online, but I was left feeling totally incompetent and overwhelmed. Everyone had said coding was so easy to pick up, but I felt dumb, struggling with all the terminology so foreign to me. Also, it was difficult to gauge the relevancy and helpfulness of certain resources over others. Finally, after lots of YouTube videos and googling—plus some help from programmer friends—I learned some of the basics.
Armed with a little bit of confidence in my blossoming skill (but still lots of questions), I am setting out to give other absolute beginners like me an honest, simplified introduction to Python. If you have wanted to learn coding but felt overwhelmed by all the possibilities in front of you, this lesson is for you. You will learn how to set up Python, starting writing some basic code, and finally, test your skills by creating a MadLibs Generator.
TERMS
Before getting started, I’ll define some terms that I came across during the process.
Python - This is one of many programming languages. From what I have heard, it is the easiest one to pick up for beginners, and it is also used often for lots of different websites and programs. I suggest skimming the Wikipedia entry and browsing around the official website.
Command line - Also known as the command shell, Command Prompt, or Terminal on Macs, this is basically an application that lets you interact with your computer just through lines of text. For example, instead of browsing through your files and clicking on one in the file explorer, you just type a “command” into the command line. For this tutorial, it will be the place you run your Python code. If you want to learn more about the command line and different commands you can use, check out the Wikipedia entry and this helpful guide.
Text Editor – An application in which you actually write your code. A good example of a basic text editor is the MS Notepad. It allows you to open, edit, and save files that you can then run through Python to create a program. At first I thought this just meant a Word Document!
SETTING UP PYTHON
Now that you have the essential terms down, let’s get started. First, you will need to open up your command line. Here is an explanation of how to do that for different operating systems. If you are running Windows, it should look something like this.
Now it’s time to download Python. Some computers already have Python pre-installed. To check if yours does, just type “python –V” (make sure to capitalize the V) into the command line and see if anything pops up. If not, head to the official Python website to download the program, and check out this beginner’s download guide. Python has two versions—the newest edition of Python 3 is what you want to use. They update it often, but at the time of writing this it is version 3.6.4. Follow along with this video for an in-depth step-by-step install and setup process (you can stop watching after 1:20 because he uses a different text editor than we will use).
After that, you should download a Text Editor. There are lots of different Text Editors out there, and in the video above he opts for Pycharm, an IDE (Integrated Development Environment), which is basically a more complex version of a Text Editor. But for my purposes I wanted something a little simpler. From my survey of two programmers that I trust, Sublime Text is the way to go for new programmers. It is super simple to download and you can find it here.
Now you have all the necessary components to start coding! Take a moment to celebrate the victory: the hardest part is basically over.
TIP: The biggest thing that tripped me up when getting Python set up was learning how to add it to my system path. If you have no idea what that means, that’s fine because I didn’t either. In the video above he tells you to tick the box when installing that automatically adds it to your path: learn from my mistake and make sure you tick that in order to avoid adding it manually.
LEARNING THE BASICS
There are lots of different YouTube Tutorials that can help you learn the basics of Python. What I found that helped the most was jumping around between a couple tutorials.
Below, I’ll link a couple tutorials that I found most helpful in grasping the basics. I recommend doing the first couple of tutorials to get the hang of things before jumping into the next section:
Although this series is from 2014, it actually helped me understand the most. Up above, I linked the updated version of this series from 2017 to help with downloading, but for some reason, I enjoyed this version better. I suggest watching the first two tutorials to get down some of the basics.
In this 2016 tutorial, Chris shows you how to set up Python and code using Visual Studio Code. This is another text editor that comes highly recommended from the programmers I asked. Because I wanted to get a handle of a simple text editor and the command line first, I didn’t use it, but I think I will in future coding attempts.
Although I like to use videos, I realize some out there may prefer written explanations! After looking around, this resource appears to be the best written tutorial I found.
TIP: Because there is a lot of variation in the different ways people code, all the tutorials do at least one thing differently. Not to mention that some of the tutorials and resources I include are older. Don’t let that trip you up. If they are using a different text editor or their screen looks different, that is okay. The instructions are still helpful.
TIP: Some of the tutorials above go into this, but I want to emphasize the importance of using either tabs or spaces when you are writing your code. Python is white-space delimited (meaning it differentiates between parts of code through indentation). To make your code run successfully, make sure to use either tabs or spaces consistently. They may look the same, but they appear differently in code.
MADLIBS GENERATOR
If you have made it past everything above, this will probably be the easiest part (and the most fun!). Now that you have the basics down, it is time to test your skills with your first project: making a MadLibs generator. This is just a project focused on input fields for someone to fill in with different words to create a sentence.
All you have to do is follow along with this video to create your Madlib. Once you have the script he shows you down, start experimenting! I’ve included my finished MadLib here:
CONCLUSION
You have successfully coded your first Python project! Congratulations! If you are like me, you’ll want to just keep going as soon as you finish. Luckily, there is a ton left to learn. Below I have included a couple of resources to help you continue on your coding journey. I hope this tutorial has eased you into the sometimes overwhelming world of coding!
Thank you for reading!
KEEP GOING!
Now that you have successfully conquered MadLibs, try out some of these other mini projects!
If you have made it through this tutorial but would like a more structured approach to learning the language, I highly recommend enrolling in this free course for beginners!
This site has a plethora of information for programmers just starting out. Although it can be overwhelming to navigate through, take it step-by-step and project-by-project.
Once you are a little more familiar with Python and all its terminology, this library for all things concerning Python is incredibly useful.