My Blog

Python on Cloud

1-click AWS Deployment    1-click Azure Deployment 1-click Google Deployment

Overview

Python is a relaxed to learn, influential programming language. It has an effective top-level data structures and a simple but effective approach to object-oriented programming. Python’s sophisticated syntax and dynamic typing, together with its taken nature, make it an ideal language for scripting and speedy application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third-party Python modules, programs and tools, and additional documentation. The Python interpreter is easily extensive with new functions and data types implemented in C or C++ Python is also appropriate as an extension language for customizable applications. Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum Like Perl, Python source code is also available under the GNU General Public License (GPL).

Python is a general purpose, dynamic, high-level, and interpreted programming language. It supports Object Oriented programming approach to develop applications. It is simple and easy to learn and provides lots of high-level data structures. Python is easy to learn yet powerful and versatile scripting language, which makes it attractive for Application Development. Python’s syntax and dynamic typing with its interpreted nature make it an ideal language for scripting and rapid application development.

Python supports multiple programming pattern, including object-oriented, imperative, and functional or procedural programming styles.

Python is not intended to work in a particular area, such as web programming. That is why it is known as multipurpose programming language because it can be used with web, enterprise, 3D CAD, etc.

We don’t need to use data types to declare variable because it is dynamically typed so we can write a=10 to assign an integer value in an integer variable.

Python makes the development and debugging fast because there is no compilation step included in Python development, and edit-test-debug cycle is very fast.

Python 2 vs. Python 3

In most of the programming languages, whenever a new version releases, it supports the features and syntax of the existing version of the language, therefore, it is easier for the projects to switch in the newer version. However, in the case of Python, the two versions Python 2 and Python 3 are very much different from each other.

A list of differences between Python 2 and Python 3 are given below:

  1. Python 2 uses print as a statement and used as print “something” to print some string on the console. On the other hand, Python 3 uses print as a function and used as print(“something”) to print something on the console.
  2. Python 2 uses the function raw_input() to accept the user’s input. It returns the string representing the value, which is typed by the user. To convert it into the integer, we need to use the int() function in Python. On the other hand, Python 3 uses input() function which automatically interpreted the type of input entered by the user. However, we can cast this value to any type by using primitive functions (int(), str(), etc.).
  3. In Python 2, the implicit string type is ASCII, whereas, in Python 3, the implicit string type is Unicode.
  4. Python 3 doesn’t contain the xrange() function of Python 2. The xrange() is the variant of range() function which returns a xrange object that works similar to Java iterator. The range() returns a list for example the function range(0,3) contains 0, 1, 2.
  5. There is also a small change made in Exception handling in Python 3. It defines a keyword as which is necessary to be used.

Why to Learn Python?

 Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.

Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Python:

  • Python is Interpreted− Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
  • Python is Interactive− You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
  • Python is Object-Oriented− Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
  • Python is a Beginner’s Language− Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.

Characteristics of Python

Following are important characteristics of Python Programming −

  • It supports functional and structured programming methods as well as OOP.
  • It can be used as a scripting language or can be compiled to byte-code for building large applications.
  • It provides very high-level dynamic data types and supports dynamic type checking.
  • It supports automatic garbage collection.
  • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Applications of Python

Python is one of the most extensively used language over the web:

  • Easy-to-learn− Python has few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language quickly.
  • Easy-to-read− Python code is more clearly defined and visible to the eyes.
  • Easy-to-maintain− Python’s source code is fairly easy-to-maintain.
  • A broad standard library− Python’s bulk of the library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh.
  • Interactive Mode− Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.
  • Portable− Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
  • Extendable− You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient.
  • Databases− Python provides interfaces to all major commercial databases.
  • GUI Programming− Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix.
  • Scalable− Python provides a better structure and support for large programs than shell scripting.

Why we Should Learn Python?

Python is an object-oriented and open-source language developed in the 1980s by Dutchman Guido van Rossum. Tech Giants like Cisco, IBM, Mozilla, Google, Quora, Hewlett-Packard, Dropbox, and Qualcomm are using this language owing to its simplicity and elegance. Most developers prefer Python over the plethora of programming languages out there because of its emphasis on readability and efficiency. There are several reasons why you should consider Python training. A course in Python can provide numerous benefits to the users.

Following are the major features and applications of Python :

  1. Data Science: Python is the preferred programming language of most data scientists. Be it IT ops, software development or marketing, currently every job makes use of data and depends on it to drive their operations. With the release of ‘Numpy‘and ‘Pandas’, Python rose to prominence in the world of data. Python also handles statistical, tabular and matrix data and also visualizes it with libraries like ‘Matplotlib’and ‘Seaborn‘.
    Moreover, in the data science arena, python job postings outnumber all others. This indicates the fact that the skills you gain with Python will directly transfer to developing your analytic skills.
  2. Easy to Learn: Python is an easy language to master. This is chiefly because of its resemblance to the English language. Python’s syntax is characterized by very few rules and special cases. It’s safe to say that in Python the focus is on what you want to do with the code, not on language intricacies. Anybody can master Python easily. With practice, newbies can build a basic game in mere days using python. Another attractive aspect of this programming language is its efficiency and readability.
  3. Cross-Platform and Open Source: It’s been more than 20 years since this language has been running cross-platform and open source. Be it Linux, Windowsor MacOS, Python code works on every platform. Another remarkable thing about Python is that it’s supported by decades of bug-squashing and kink-straightening which ensures that its code works as intended whenever the user runs it.
  4. Versatile Language and Platform: Python remains very relevant today as it can be used in any operations scenario or software development, be it in managing local and cloud infrastructure, working against a SQL database, developing a custom function for Hive & Pig, supporting object-oriented design or even developing a small tool for the user.
  5. Vast Libraries: Python is supported by PyPIwhich has 85,000+python scripts and modules accessible to the user. These modules provide pre-packaged functionality available to the users in their local Python environment. It can solve diverse problems such as executing advanced data analytics like developing REStful web services or sentiment analysis and establishing computer vision.
  6. Flexibility: Python has several powerful applications integrated with other programming languages. Details about these are given as follows:
  • .Net and C#compatible: IronPython
  • A version with C: CPython
  • Python combined with Ruby: RubyPython
  • Python integrated with Java: Jython
  • Python written with Objective C toolkits: PyObjc
  1. High Salary: The salary of Python engineers is comparatively higher as compared to others in the industry
  2. Scripting and Automation: What most people don’t know about Python is that it can be used as a scripting language. In scripting, the code is written in script form and gets executed. So the code is read and interpreted by the machine and errors are checked during runtime. After the code is checked, it can be used many times. It is also possible to automate specific tasks in a problem by automation.
  3. Artificial Intelligence: Without any dispute, Artificial intelligence is going to lead the future IT. Python’s libraries such as Kerasand TensorFlowenables machine learning functionality. Also, libraries like OpenCV aids in computer vision or image recognition.
  4. Computer Graphics: Python can be employed in small, large, online or offline projects. It is used to develop GUI and desktop applications. It’s ‘Tkinter’library enables simple and rapid application development. This programming language is also used in game development where the logic is written using a module ‘pygame’ which can also run on android devices.
  5. Testing Framework: This language is an excellent tool for validating the products or ideas for established enterprises. Python has numerous built-in testing frameworks that deal with debugging and rapid workflows. Its tools and modules such as Seleniumand Splinterwork to make things easier. Python also supports cross-platform and cross-browser testing with frameworks like PyTest and Robot framework.
  6. Web Development: Python’s different frameworks support website development. Python has an array of frameworks for developing websites. Popular frameworks such as Django, Flask,and Pylonsare characterized by faster and stable code; this is because they are written in Python. Using Python, the users can perform web scraping which means fetching details from other websites.–

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn’t catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python’s introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.

Internal working of Python

Python is an object oriented programming language like Java. Python is called an interpreted language. Python uses code modules that are interchangeable instead of a single long list of instructions that was standard for functional programming languages. The standard implementation of python is called “cpython”. It is the default and widely used implementation of the Python.
Python doesn’t convert its code into machine code, something that hardware can understand. It actually converts it into something called byte code. So within python, compilation happens, but it’s just not into a machine language. It is into byte code and this byte code can’t be understood by CPU. So we need actually an interpreter called the python virtual machine. The python virtual machine executes the byte codes.

The Python interpreter performs following tasks to execute a Python program :

  • Step 1 : The interpreter reads a python code or instruction. Then it verifies that the instruction is well formatted, i.e. it checks the syntax of each line.If it encounters any error, it immediately halts the translation and shows an error message.
  • Step 2 : If there is no error, i.e. if the python instruction or code is well formatted then the interpreter translates it into its equivalent form in intermediate language called “Byte code”.Thus, after successful execution of Python script or code, it is completely translated into Byte code.
  • Step 3 : Byte code is sent to the Python Virtual Machine(PVM).Here again the byte code is executed on PVM.If an error occurs during this execution then the execution is halted with an error messag

                                           

 

 

Features

Python Features

Python provides lots of features that are listed below.

1) Easy to Learn and Use

Python is easy to learn and use. It is developer-friendly and high-level programming language.

2) Expressive Language

Python language is more expressive means that it is more understandable and readable.

3) Interpreted Language

Python is an interpreted language i.e. interpreter executes the code line by line at a time. This makes debugging easy and thus suitable for beginners.

4) Cross-platform Language

Python can run equally on different platforms such as Windows, Linux, Unix and Macintosh etc. So, we can say that Python is a portable language.

5) Free and Open Source

Python language is freely available at official web address. The source-code is also available. Hence, it is open source.

6) Object-Oriented Language

Python supports object-oriented language and concepts of classes and objects come into existence.

7) Extensible

It implies that other languages such as C/C++ can be used to compile the code and thus it can be used further in our python code.

8) Large Standard Library

Python has a large and broad library and prvides rich set of module and functions for rapid application development.

9) GUI Programming Support

Graphical user interfaces can be developed using Python.

10) Integrated

It can be easily integrated with languages like C, C++, JAVA etc

11 Interpreted Language:
Python is an Interpreted Language. because python code is executed line by line at a time. like other language c, c++, java etc there is no need to compile python code this makes it easier to debug our code.The source code of python is converted into an immediate form called bytecode.

 

12 Large Standard Library
Python has a large standard library which provides rich set of module and functions so you do not have to write your own code for every single thing.There are many libraries present in python for such as regular expressions, unit-testing, web browsers etc.

  1. Dynamically Typed Language:
    Python is dynamically-typed language. That means the type (for example- int, double, long etc) for a variable is decided at run time not in advance. because of this feature we don’t need to specify the type of variable.

Python reflects a number of growing trends in software development. It is a very simple language surrounded by a vast library of add-on modules. It is an open source project, supported by dozens of individuals. It is an object-oriented language. It is a platform-independent, scripted language, with complete access to operating system API’s. It supports integration of complex solutions from pre-built components. It is a dynamic language, allowing more run-time flexibility than statically compiled languages.

Additionally, Python is a scripting language with full access to Operating System (OS) services. Consequently, Python can create high level solutions built up from other complete programs. This allows someone to integrate applications seamlessly, creating high-powered, highly-focused meta-applications. This kind of very-high-level programming (programming in the large) is often attempted with shell scripting tools. However, the programming power in most shell script languages is severely limited. Python is a complete programming language in its own right, allowing a powerful mixture of existing application programs and unique processing to be combined.

Python includes the basic text manipulation facilities of Awk or Perl. It extends these with extensive OS services and other useful packages. It also includes some additional data types and an easier-to-read syntax than either of these languages.

Python has several layers of program organization. The Python package is the broadest organizational unit; it is collection of modules. The Python module, analogous to the Java package, is the next level of grouping. A module may have one or more classes and free functions. A class has a number of static (class-level) variables, instance variables and methods. We’ll lookl at these layers in detail in appropriate sections.

Some languages (like COBOL) have features that are folded into the language itself, leading to a complicated mixture of core features, optional extensions, operating-system features and special-purpose data structures or algorithms. These poorly designed languages may have problems with portability. This complexity makes these languages hard to learn. One hint that a language has too many features is that a language subset is available. Python suffers from none of these defects: the language has only 21 statements (of which five are declaratory in nature), the compiler is simple and portable. This makes the the language is easy to learn, with no need to create a simplified language subset.

  • Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
  • Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
  • Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
  • Python is a Beginner’s Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.

 

AWS


Installation Instructions For Ubuntu

Installation Instructions For Ubuntu

Note: How to find PublicDNS in AWS

Step 1) SSH Connection: To connect to the deployed instance, Please follow Instructions to Connect to Ubuntu instance on AWS Cloud

1) Download Putty.

2) Connect to the virtual machine using SSH key Refer this link:

  • Hostname: PublicDNS  / IP of machine
  • Port : 22

Step 2) Other Information:

1.Default ports:

  • Linux Machines:  SSH Port – 22

2. To access Webmin interface for management please follow this link

Configure custom inbound and outbound rules using this link

Azure


Installation Instructions For Ubuntu

Installation Instructions For Ubuntu

Note: How to find PublicDNS in Azure

Step 1) SSH Connection: To connect to the deployed instance, Please follow Instructions to Connect to Ubuntu instance on Azure Cloud

1) Download Putty.

2) Connect to the virtual machine using following SSH credentials:

  • Hostname: PublicDNS  / IP of machine
  • Port : 22

Username: Your chosen username when you created the machine ( For example:  Azureuser)

Password: Your Chosen Password when you created the machine ( How to reset the password if you do not remember)

Step 2) Other Information:

1.Default ports:

  • Linux Machines:  SSH Port – 22

2. To access Webmin interface for management please follow this link

Configure custom inbound and outbound rules using this link

Google

Installation Instructions For Ubuntu

Installation Instructions For Ubuntu

Step 1) SSH Connection: To connect to the deployed instance, Please follow Instructions to Connect to Ubuntu instance on Google Cloud

1) Download Putty.

2) Connect to the virtual machine using SSH key

  • Hostname: PublicDNS  / IP of machine
  • Port : 22

Step 2) Other Information:

1.Default ports:

  • Linux Machines:  SSH Port – 22

2. To access Webmin interface for management please follow this link

 

Video

 

Python on Cloud

Related Posts