Python Fundamentals Part 1

Overview

Hello Guys, this article is the first part of the Python fundamentals trilogy. Python is a big language, and a single course can’t possibly cover everything there is to know, this article will serve you well with solid foundation for becoming productive in python.

 

 

Firstly, what is so great about python? Why do you want to learn it?

Python is powerful meaning it is expressive and productive so you can create solutions quickly. Often you don’t need to write much code as python comes with a great standard library.

This makes python very popular across web development, scientific computing, cloud configuration, data science and education.

In Web Development

Python has taken a prominent position in web development providing the backend for high traffic sites including YouTube, Instagram, Reddit and Dropbox using python web frameworks such as Django, Flask, Pyramid.

In Cloud Computation

Python plays a huge role in cloud computation in deploying systems to cloud with python based tools such as Ansible for configuration management, Boto3 for Amazon Web Service and Microsoft Azure development kit for Python.

In Data Analytics

Python plays a vital role in data analysis using tools such as Pandas, Bokeh, TesnorFlow, Scikit learning.

With Python, you can build applications quickly, safely and efficiently. Python is also open source so you can know every aspect of it if you want.

What is Python?

Python is a programming language. Python is developed as an open source project and is free to download. It is strongly typed language in a sense that every object in a language has a definite type. Python is dynamically typed meaning that there is no type check on the code prior to running it. It uses duck typing where object suitability is only determined at runtime. Python is general purpose programming language and is not intended to use in any particular domain or environment.

Who is using Python?

 Python Fundamentals

Python is an interpreted language. This is a bit of a misstatement technically because Python is normally compiled into a form of bytecode before it’s executed, however, this compilation happens invisibly, and the experience of using Python is one of immediately executing code without a noticeable compilation phase. This lack of an interruption between editing and running is one of the great joys of working with Python.

The syntax of Python is designed to be clear, readable, and expressive. Unlike many popular languages, Python uses white space to delimit code blocks and, in the process, does away with reams of unnecessary parentheses while enforcing a universal layout. This means that all Python looks alike in important ways, and you can learn to read Python very quickly. At the same time, Python’s expressive syntax means that you can get a lot of meaning into a single line of code. This expressive, highly readable code means that Python maintenance is relatively easy.

Implementations of python

There are multiple implementations of the Python language. The original and still by far the most common implementation is written in C. This version is commonly referred to as CPython. When someone talks about running Python, it’s normally safe to assume that they are talking about C Python. Other implementations of Python include Jython which is written to target the Java virtual machine, IronPython which targets the .NET Runtime, and PyPy which is written in a specialized subset of Python called RPython.

These implementations generally trail behind CPython which is considered to be the standard for the language. There are two important versions of the Python language in common use right now, Python 2, and Python 3.These two versions represent changes in some key elements of the language, and code written for one will not generally work for the other unless you take special precautions. Python 2 is older and better established than Python 3, but Python 3 addresses some known shortcomings in the older version. Python 3 is the definite future of Python, and you should use it if at all possible. While there are some critical differences between Python 2 and 3, most of the fundamentals of the two versions are the same. If you learn one, most of what you know transfers cleanly to the other.

 

Python comes with powerful and broad standard library! Part of the Python philosophy is Batteries Included, meaning that you can use Python for many complex, real-world tasks out of the box, with no need to install third-party packages. This is not only extremely convenient, but it means that it’s easier to get started learning Python using interesting engaging examples, something we aim for in this course.

Another great effect of the batteries-included approach is that it means that many scripts, even non-trivial ones, can be run immediately on any Python installation. This removes a common annoying barrier to installing software that you face with some languages.

The standard library has a generally high level of good documentation. APRS are well documented, and the modules often have good narrative descriptions with quick start guides, best practice information, and so forth. The standard library documentation is always available online at python.org, and you can install it locally if you need to. Many of Python’s principles are embodied in the so-called Zen of Python. The Zen isn’t a hardened fast set of rules, but rather a set of guidelines or touchstones to keep in mind when coding. When you find yourself trying to decide between several courses of action, these principles can often give you a nudge in the right direction.

Installing Python 3 on Windows

Let’s see how to install Python 3 on Windows 10. For Windows, you need to visit the official Python website at python.org and then, navigate via the Downloads tab to the Downloads for Windows and click the button to begin downloading the latest Python 3 version. When given the option, choose to run the Installer. After the Installer starts, be sure to enable the option to add Python to the path environment variable before moving on, by clicking Install Now.

You may be asked to approve the Python Installer making changes to your device, which you should accept. After a few seconds, the Installer will complete and you can close the Installer and your web browser. We’ll be working with Python from the command-line, so via the Context Menu on the Start button choose Windows PowerShell. On older versions of Windows, you may need to use the CMD Shell instead. And start Python just by typing python, followed by Enter. Welcome to Python. The triple arrow prompt shows you that Python is waiting for your input. s point, forward while we show you how to install Py

 

Installing Python 3 on macOS X

Now, let’s see how to install Python 3 on Mac OS. For Mac OS, you need to visit the official Python website at python.org. Navigate via the Downloads tab to the Downloads for Mac OS and click the button to begin downloading the latest Python 3 version. A package file downloads, which when opened launches the Python Installer.

Continue through the install process, accepting the license agreement and using the default installation location. You may need to provide your password as you go. Although Mac OS does include a Python interpreter, it’s the legacy Python 2.7 version and for this course, we use Python 3. The Python 3 version we’re installing here will sit alongside the system Python 2 and won’t interfere with the correct operation of your Mac. When Python is installed, you can clean up by moving the Installer to the Trash. To use Python, open a terminal. Here, we’re using Spotlight to do so, and run Python 3 from the command-line. Welcome to Python. The triple arrow prompt shows that Python is waiting for your input.

 

Installing Python 3 on Linux

 

The last operating system we’ll look at is Linux, which is the easiest of all. Recent versions of Ubuntu Linux include Python 3 out of the box, so no installation is required. To begin using Python, open a terminal. On Ubuntu, we can do this by using the search function accessible through the Ubuntu icon, top left, entering the terminal, and launching the Terminal Application. In the terminal, you should be able to start Python 3. Welcome to Python. The triple arrow prompt shows you that Python is waiting for your input. If you’re using a version of Linux other than Ubuntu, you’ll need to find out how to invoke and possibly install Python 3 on your system.

 

 

You have reached the end of the first trilogy in python fundamental series. I hope you enjoyed it. Python is a big language with a huge ecosystem of software built in and around it, and it can be a real adventure to discover everything it has to offer. Stay tuned for the next part for more learning!

Happy Coding!

 

Leave a Reply

Your email address will not be published. Required fields are marked *