In this short tutorial, we'll cover the basics of the Python language, show you how to install it, how to run programs.

Contents

A Short Python tutorial The Intelligent Investor
We walk through all the main topics using examples.

First of all, what is Python? According to https://python.org/python-workout-50-ten-minute-exercises/ and its creator Guido van Rossum, Python is:

"A high-level programming language and its core design philosophy is all about code readability and the syntax that allows programmers to express concepts in multiple lines of code."

We can use Python coding in many different ways: data science, task automation, scripting, web development, and machine learning shine here. Quora, Pinterest, and Spotify use Python for their internal web development. So let's learn a little about this language and break down its basics.

Fast start

Python is an interpreted programming language, which means that as a developer you write Python .py files in a text editor and then put those files into the Python interpreter for execution.

The way to run a Python file on the command line is as follows:

C: Users Y our Name> python helloworld. py

Where helloworld.py is the name of your python file like shown here Python.

Let's write our first Python file, helloworld.py, that can be done with any text editor.

Python command line

To test a small amount of Python code, it is sometimes easiest and fastest not to write the code to a file. This is possible because Python can be run from the command line.

Enter the following at the Windows, Mac, or Linux command prompt:

C: Users Y our Name> python

Or, if the python command didn't work, you can try py:

C: Users Y our Name> py

Variables

You can think of variables as words that hold meaning. As simple as that.

In Python it is really easy to define a variable and assign a value to it - pandas reset_index for reference. Imagine that you want to store number 1 in a variable called one.

And you can assign any other value to any other variable you want. As you can see in the table above, the variable two holds the integer 2, and some_number holds 10,000.

Besides integers, we can also use boolean booleans (True or False), strings, floating point numbers, and many other data types.