FIU Data Science Bootcamp Application Deadline is Oct. 3 - Apply Now

Python Guide: Tutorial For Beginners

By Adam Wearne • July 28, 2021

Hello! Welcome to this brief introduction to Python. In this article, we'll provide an overview of the Python language, some of its many use cases, how to install Python on your computer, and how to use Python. At the end of this article, we'll also leave with some parting thoughts on how long it takes to learn Python and some ways you can incorporate Python learning into your daily life. Let's get started!

What is Python?

Python is a high-level programming language widely used across the tech industry by data scientists, software engineers, analysts, and many other technical roles. Beyond its general ability to tackle all sorts of programming problems and tasks, one of the reasons for Python's incredible popularity, especially among those who are new to programming, is its simple syntax. Take a look at the two following code snippets as an example written in Python and Java. Both are simple programs to instruct the computer to print the text "Hello World!"


print("Hello World!")


class HelloProgram
public static void main(String[] args) {
System.out.println("Hello World!");


Languages like Java and others are really powerful and have great use cases for them as well, but if you're just starting out on your programming journey, Python is an excellent language that allows you to first focus on the basics of programming and gradually ramp up to more advanced material.

What is Python used for, and what can you do with Python?

So in the last section, we describe what Python is, but what can we do with it? Lots! One of the reasons for Python's widespread adoption is that it is a very flexible programming language that can accomplish a wide range of tasks. 

As an analyst, you might use Python to interact with SQL or some other query language to generate automated reports, assess the business impact of a sales promotion, examine how users interact with your company's product, and so on.

As a data scientist, you might find yourself training machine learning models, assess their performance, and preparing them to be used in a production setting. 

On a slightly different note, you could also use Python to build entire websites and APIs. Everything from user login systems, database models, and security can be handled entirely with Python.

There are some programming tasks where Python isn't the best language to choose, however. Applications where execution speed is paramount (think high-frequency trading), mobile app development, and video game development are a few examples. That's not to say one can't do these things with Python, just that there are other programming languages out there that are better suited to these particular tasks.

Introduction to Python: Starting Out

How to install Python

In this section, I will describe two ways we can install Python on our system. In fact, depending on what operating system you are using, you may have Python installed already!

Anaconda Python Installation

One fast and simple way to get up and running with Python is to use Anaconda. Anaconda is a really convenient version of Python that bundles together lots of Python libraries that are commonly used in data science and scientific computing, along with Jupyter Notebook and Jupyter Lab, which are useful coding environments, along with several other useful pieces of software.

To get started with the Anaconda distribution of Python, go to Anaconda's installation instructions and follow the corresponding instructions for your particular operating system. Another convenient aspect of this installation method is that there is no complicated fiddling with the command terminal needed. Anaconda provides a simple GUI installation guide that makes the process really easy.

Pyenv Python Installation

Anaconda is great, but there are other methods as well. Perhaps this isn't your first rodeo, and you do have some experience working with a terminal in a Linux/Unix environment. What I will describe here is another method for installing different versions of Python using a tool called pyenv. This section is meant for slightly more advanced users - feel ready to follow along or advance to the next section if desired!

pyenv is a useful tool for managing multiple installations of Python. Why would you want to have multiple installations in the first place? Well, like any piece of software, there are different versions of Python. Depending on what you're working on, you may run into a scenario where you need a specific version of Python to do Project A and a different version for Project B. pyenv helps us resolve this situation by allowing us to easily swap between what version of Python we're using.

To install it, simply open up a terminal prompt and run the command curl | bash

You'll likely also need to add pyenv to your PATH parameter after it is installed. Once successful, you can see what versions of Python you have currently installed by running pyenv versions. Mine looks something like this

* system (set by /Users/adam.wearne/.pyenv/version)

Here, you can see the different versions of Python I have on my own computer, as well as what version is currently active as denoted by the asterisk. Here, it's just the system version of Python that came pre-installed on my laptop.

To install a new version of Python, it's as simple as: pyenv install <YOUR-DESIRED-VERSION>.

There are now a couple of ways we can use our different versions of Python. To change what Python your default version is, run the command pyenv global <YOUR-DESIRED-VERSION> or specify only that a specific project folder/directory should use a certain version of Python, you can run pyenv local <YOUR-DESIRED-VERSION>. These are just some of the basic commands to get you started. Check out the associated project page to learn more.

How long does it take to learn Python?

Like any skill, mastering Python may take some time. However, one of the great benefits of Python relative to other languages is that it is very beginner-friendly and one can actually pick up the basics in a relatively short period of time. Having experience from other programming languages certainly helps, but even if you've never programmed before, you will likely find that the syntax and structure of Python code is really straightforward.

If you are completely new to programming and have the benefit of being able to devote several hours per week to studying and practicing Python, you should be able to cover all the basics within the span of six weeks or so. Of course, even with the basics covered, there are always new things to be learned and ways to sharpen your skills.

How to use Python

If you've followed along with the installation portion, you may now be wondering: "How do I actually use Python now that I've installed it?" There are a couple options that I will describe briefly here.

If you've installed via Anaconda, go ahead and launch Anaconda Navigator, and from there, launch either JupyterLab or Jupyter Notebook. You may see a terminal window pop up with a flurry of text, and a new tab will open up in your internet browser. In this new tab, you will find something that looks like a File Navigator with all the files and folders that exist on your computer. Near the upper-right corner of the screen, you should find a "New" button. Go ahead and click that button to create a new Jupyter Notebook. This will open up a lightweight coding environment where we can start writing Python! Try entering the small Python program we wrote earlier in the article, and press the "Run" button inside the Jupyter Notebook. Congratulations! You've just written your first lines of Python code! Jupyter has a lot of great features and handy shortcuts that are really worth learning about, but fall a little outside the scope of this brief article. Check out the official Jupyter website for more info.

The other simple option to get things running quickly is to open up a terminal window, and simply type in the command python. This launches the Python shell in your terminal window. Here you can enter in Python commands and test out simple programs. Try running our "Hello World" program in the shell environment too!

Both Jupyter notebooks and the Python shell are great for experimenting and trying out quick snippets of code, but as you advance in your Python journey, you may need a more fully-fledged coding environment for organizing your Python files, debugging, and getting your code production-ready. There are many great editors out there, but here are a few recommendations that are worth checking out: Sublime Text is a nice light-weight text editor with various plugins for Python programming (and other languages!). Sometimes fully-fledged IDEs can seem a little overwhelming with all their options and features, so this might be a good place to start.

Probably the most popular two editors that folks like to use in the Python ecosystem are Pycharm and VSCode. Both of these have lots of really rich features that really improve your developer quality of life over time. There are lots of different options and features here, so the learning curve is a little steeper than something like Sublime or Jupyter, but they're both worth checking out.

Beginner Python projects you can do at work

There are lots of resources out there for coding challenges, interview exercises, and programming brain-teasers that can help you gain comfort with Python, but I believe the best way to really solidify your knowledge of Python is to make the programming exercises you're working on relevant to your everyday life.

Have you ever had to make a spreadsheet to do some calculation as part of your job? Challenge yourself to recreate your calculations using Python! We haven't mentioned it in this article, but there is a Python library called pandas which has many of the common features you'd find in any modern spreadsheet software.

Have you ever found yourself regularly repeating some task in your OS's file system? Copying/moving files, renaming them, deleting old files, downloading files, etc. Python comes pre-installed with several libraries that can aid in doing all of these common operating system tasks, and organizing file clutter without having to manually click and drag tons of files.

What about making charts, graphs, figures, and tables for presentations? matplotlib, seaborn, and bokeh are just a few examples in Python's rich plotting ecosystem for creating informative, aesthetically pleasing, and even interactive graphs.

Want to learn more about how to use Python?

Below are a few links to some of the most common libraries in the Python data science ecosystem that you might want to check out!

- Pandas - This is essentially the Python equivalent of any popular spreadsheet software you may have used in the past. There are many familiar functions, and more!

- Seaborn - One of the many amazing Python packages available for creating rich, informative, and beautiful plots. Check out the tutorial and example gallery sections!

- Scikit-learn - When you're feeling up for it, feel free to browse one of Python's most popular machine learning libraries. Included in this library are TONS of useful machine learning models, utility functions, and great documentation and examples.

Similar Posts

data science
Learn Machine Learning in 6 Months

By Zachariah Miller • May 24, 2021

I came across a question on Quora that boiled down to: "How can I learn machine learning in six months?" I started to write up a short answer, but it quickly snowballed into a huge discussion of the pedagogical approach I used and how I made the transition from physics nerd to physics-nerd-with-machine-learning-in-his-toolbelt to data scientist. Here's a roadmap highlighting major points along the way.

data science
Made at Metis: Predicting Stock Performance & AI-Generated Guided Meditations

By Emily Wilson • July 27, 2020

This post features two projects from recent graduates of our data science bootcamp. Take a look at what's possible to create in just 12 weeks.

data science
How to Become a Data Scientist

By Carlos Russo • April 16, 2021

Data science jobs are plentiful in today’s job market. Read on to learn about what data scientists do, what kinds of data science-related jobs are available, and how to become a data scientist.