Beginners tutorial in python – 2) Set Up

<– Previous- Introduction

This step tends to be one where many begin to run into obstacles getting started with python and rightfully so. Some of the things that beginners struggle with involve getting the right IDE, installing python and figuring out what this pip thing is. Rather than place barriers in your way to get started, I will lay out the easiest path for you. We will use the command line and a simple text editor(of your choice). In the interest of staying up to date with the latest and greatest of python, we will make the decision to stick with python 3.6.

My Freelance Paycheck – Start Your Career as A Freelancer Today

Installing Python

If you are on Mac or any Linux installation, you will already have python 2.X installed on your machine by default. You will need to do the following to update to python 3:

Linux-apt-get

sudo apt-get update

sudo apt-get install python3.6

Mac-homebrew

brew install python

Windows

Go to this link to download the latest executable package to install python 3.

https://www.python.org/downloads/windows/

Scroll down and find the write package for your machine architechture for the “Python 3.6.8 – 2018-12-24″ Version.

Work As A Tutor Online – Online Tutoring Jobs!

Verifying python Version

Once you have installed python(or at least think you have), the best thing to do next is make sure its there and ready to rock. You can do this by calling “python –version” from a terminal window. If you have multiple versions of python running(particularly on mac), you may have to call it explicitly as version 3: “python3 –version”. You should then see version python 3 printed below your command:

python --version
Python 3.6.5

Hello World in Python

The great thing about python is that you can run code directly in the interpreter. What that means is that you don’t actually need to execute a file to run a python script, you can just type “python” in the terminal, and code away! This is extremely useful when learning python, because you can get started right away and write your first line of code immediately after installing python.

Open a fresh terminal and type “python” and Enter.

You should now be running inside the python interpreter, and should see something similar to this:

Python 3.6.5 (default, Apr 25 2018, 14:23:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>

Now enter the following:

print("hello world")

You should then see “hello world” printed back at you. Cool huh? You have just written your first python script.

Now let’s take this a step further and create your first python file. Python files should the extension “.py” and you can create them in any text editor. I’ll leave it up to you to use the one that you’re most comfortable with.

Open your favorite text editor and create and save a new file named “hello.py”. Save it in a location that is easy to get to in the command line. I would recommend starting a new directory where you can keep all of your scripts handy and reference them easily.

Open your terminal and find the directory where you saved the file. Execute the script by running the following:

python hello.py

You should then see “hello world” printed back, which means you have successfully written and executed your first python file. This calls for a celebration. Don’t get too carried away, maybe get your favorite dessert, or you favorite cup of joe. You’ve reached your first milestone, and it’s definitely worth a pat on the back.

Next- Print Statements, Variables, Dictionaries & Lists –>

NETGEAR R6700 Nighthawk AC1750 Dual Band Smart WiFi Router, Gigabit Ethernet (R6700) Price $89.99