Introduction to Python Programming. Section 1. Introduction

1 Introduction

1.1 Objectives

In this section you will learn:

  • About compiled and interpreted programming languages.
  • The history and basic facts about Python.
  • How to access the NCLab virtual desktop and open the Python app.
  • How to use the Python app to write and run your Python programs.

1.2 Why learn Python?

Python is one of the most attractive programming languages that one can learn today. It is an undisputed leader in areas of the future such as big data, machine learning, and artificial intelligence. Python is easy to learn and incredibly versatile. It can be even used by non-programmers as a scientific calculator and powerful data analytics and visualization tool. It is almost unbelievable how Python is starting to dominate fields that traditionally belonged to specialized (and expensive) software products. As an example, let us take the area of data analytics which was traditionally dominated by SAS. We are going to show you two graphs. The first one, presented in Fig. 1, was taken from the webpage of Analytics Vidhya (https://www.analyticsvidhya.com). It shows that the number of job postings asking for R already surpassed the number of job postings asking for SAS:


PIC


Fig. 1: Number of job postings asking for R (blue) vs. SAS (orange).


The second graph presented in Fig. 2 shows that the number of data analytics job postings asking for Python is much higher than the number of job postings asking for R.


PIC


Fig. 2: Number of job postings asking for Python (orange) vs. R (blue).


Another example is general computing which for decades was dominated by MATLAB. Nowadays, powerful free Python libraries such as Numpy and Scipy, accompanied by advanced data visualization libraries such as Matplotlib, Mayavi and Seaborn, are taking over this area as well.

In this textbook you will learn the most important aspects of the language and you will be able to use Python to solve a large variety of practical problems. Depending on your objectives, Python may be the only programming language you will ever need. We hope that you will like Python as much as we do, and that after finishing this textbook you will want to learn more – and there always is much more to learn.

1.3 Compiled and interpreted programming languages

Python is an interpreted (as opposed to compiled) programming language. Let’s briefly explain what these words mean.

Compilation is a process where human-readable source code (text) is translated by means of a compiler and a linker into a binary (executable) file which then can be run on the concrete computer. The same source code, compiled on different hardware architectures, yields different binaries. Compiled programming languages include Pascal, C, C++, Fortran, Java and many others.

Interpreted (scripting) programming languages are more recent than the compiled ones. A program that is written using an interpreted language is "read" (parsed) at runtime – it is not compiled and there are no binaries in the traditional sense. Programs written using compiled languages are usually more efficient than programs written using the interpreted ones because the former take better advantage of the underlying hardware. On the other hand, interpreted languages are usually more universal and easier to use. Examples of interpreted languages are Python, Lua, Perl, and Ruby.

1.4 A few more details about Python

Python was conceived in the late 1980s by Guido van Rossum in the Netherlands. Its implementation was started in December 1989. The name of the language comes from the British television series Monty Python’s Flying Circus. Python 2.0 was released in October 2000 and Python 3.0 in December 2008. The newest version to-date, 3.6.5, was released on March 28, 2018

Python was twice awarded the TIOBE Programming Language of the Year award (in 2007 and in 2010). This award is given to the language with the greatest growth in popularity over the course of a year.

Python is a multi-paradigm programming language. Rather than forcing programmers to adopt a particular style of programming, it permits several styles: structured (procedural) programming and object-oriented programming are fully supported, and there are a number of language features which support functional programming.

1.5 Create a user account in NCLab

NCLab (Network Computing Lab) accessible at http://nclab.com is a public cloud computing platform that provides many apps related to computer programming, 3D modeling (CAD design), scientific computing and publishing, computer simulations, and other areas. It also provides self-paced and self-graded courses. Take a moment to visit http://nclab.com and create a user account now.

We will be programming using the Python app which is available in the Programming section of the Creative Suite as shown in Fig. 3. The Python app allows you to write, run, and debug your programs in the web browser, save them in your NCLab user account, and access them from any web browser, including tablets and other mobile devices. You can also upload data files to your user account, download your programs to a hard disk, and publish your programs to share them with others.


PIC


Fig. 3: NCLab Python app with a demo script.


1.6 Working in the cloud setting

In order to use NCLab, your device needs to be connected to the Internet. Initially, the Python app will launch with a demo script - a program which you can just run and see the result. By pressing the Play button on the bottom of the window, the code is sent to a remote cloud server, evaluated, and the results are then sent back to your web browser. This process usually takes less than a second, unless your Python program needs a longer time to run. After you do not need the demo script anymore, you can turn it off in Settings. The Python app can also be launched directly by double-clicking on a Python program in the File Manager.

1.7 Internet connection requirements

Since the amount of transfered data is relatively small, working in NCLab does not put much strain on your Internet connection. The connectivity requirements of NCLab are comparable to reading your emails.

1.8 Recommended devices

It does not matter if you are using a desktop computer, laptop, chromebook, tablet, or any other hardware platform. Your device is not used for computing - only when you work with graphics, then your graphics card may be used for image rendering. For practical reasons we do not recommend using NCLab on your phone - the phone’s display is simply too small to create an enjoyable experience.


Table of Contents

Created on August 6, 2018 in Python I,   Python II.
Add Comment
0 Comment(s)

Your Comment

By posting your comment, you agree to the privacy policy and terms of service.