GETTING STARTED: PRE-REQS - NTRODUCTION TO PROGRAMMING WITH PYTHON (2015)

INTRODUCTION TO PROGRAMMING WITH PYTHON (2015)

CHAPTER 3. GETTING STARTED: PRE-REQS

There are only two prerequisites for getting started with installing and using Python:

· Reasonable knowledge of using a computer and internet.

· A compelling desire for learning a new language for communicating with computers.

INSTALLING PYTHON ON WINDOWS

Download the latest version of Python from the official Website. [LINK]

NOTE: Two versions of the language are available, Python 2.x and Python 3.x The difference, in all its simplicity is that Python 2.x is legacy i.e. it is the one that has been installed on most devices and hence is the current norm for Python, whereas, Python 3.x is the present and future of the language.

The Windows version is downloaded as an MSI package, and can be installed with a double-click on the open shell file.

Allow the wizard to install Python to the default directory:

· For Python 3.x it will be C:\Python3x\ — (x being replaced by the version you’ve downloaded, the latest being 2.7)

NOTE: The different folders mean that you can install multiple versions of Python on the same system without causing any conflicts.

However, a single interpreter acts as the default application for Python file types.

That’s it.

You can use Python; however, it is recommended that you install the libraries and tools described next before working on writing your code. In particular, Setuptools is a must install as it allows you to easily use other third-party Python libraries.

SETUPTOOLS + PIP

From all the Setuptools, this is the most crucial third-party Python software because it extends the capabilities of the packaging and installation facilities (offered in the distutils present in the standard library).

Once the Setuptools is added to your Python system and directory, all Python compliant third-party software can be added using a single command. Furthermore, with the Setuptools installed, you can add a network installation capability to the software that you create.

Python 3, generally, comes equipped with PIP. You can download the latest version of the Setuptools for Windows HERE.

Now install PIP, a replacement for the Python command easy_install and which introduces un-installation of different packages.

VIRTUAL ENVIRONMENTS

Next, you have to install a Virtual Environment, virtualenv, a tool to keep each project self-contained and separate from one another. Think of it this way: when you write a code, it leverages the Python work environment to reduce its size (e.g. using some pre-made functions from the Python library). Hence, when it is saved, only the essential information needed for the saved file to be reopened and run in the Python work environment.

Now you create another code and save it.

Now the new project may use different library objects from Python, however, unless a mechanism exists to keep their reliance separate from one another, one program can easily conflict with the other.

A virtual environment separates all dependencies required by different projects in separate places. Hence, each program can safely run in its own safe haven.

Download it from HERE.

THE SECOND PREREQUISITE

· A strong desire to learn how to write computer programs.

If you don’t know how to program and are new of Python, then understand that as with any new language, it takes time, practice, and perseverance in face of mistakes and small failures. Hence, you must have a strong desire to learn the language to succeed.

STRONG DESIRE TO LEARN

Python requires focused effort in learning the basics, learning a new method for logically breaking down a problem into constituent parts, learning a new programming methodology (Python is an object oriented programming language), and practicing coding behavior in a new coding environment.

Don't expect a miracle to happen.

You won’t learn it by simply reaching the end of this book.

As with any language (spoken or coded), practice and experience matter a lot. Simply reading and memorizing syntax will not bring a miraculous transformation and make you an apt programmer in the field.

Unless you are willed by a true desire to learn the new language, learning to program can become boring, mistakes will compound as a de-motivating factor, and you will not ingrain a new analytic process of breaking down problems and writing solutions.

PRACTICE, MORE PRACTICE, AND EVEN MORE PRACTICE

All languages are learned by repetition and experimentation.

You have to learn how to put together phrases and create meaningful sentences out of them. With Python, it is about using the syntax and commands to create chunks of code that can perform an action (take input, compute, display an output, etc.), and do so efficiently.

This book will offer you the basics of the language, but you must will yourself to put your brain in high gear and write A LOT of code for different problems. Only then will the information that is shared in this book will stick with you.

Think of the things you have become good at over the years: talking, surfing, gaming, playing music, general knowledge about fashion, writing good essays, humor, and more. All of them needed to be practiced again and again to gain sufficient command and confidence in you abilities.

Programming with Python is quite similar to that experience.