Python Learning Guide

Python is an easy-to-learn and powerful programming language. It has powerful high-level data structures and a simple but effective object-oriented programming solution. Python’s elegant syntax, dynamic type management and interpreted nature make it the ideal language for scripts and rapid application development in many areas and on most platforms.

The Python interpreter and the extensive standard library are available freely, in the form of fonts or executables, for the most important platforms in the Python web site, http://www.python.org, and can be distributed freely.

The same site also contains distributions and addresses of many third-party modules, programs and Python tools, as well as additional documentation.

It is easy to extend the Python interpreter with new functions and data types implemented in C and C ++ (or other languages that can be accessed from C). Python is also suitable as an extension language for user-customizable applications. This guide informally presents the reader with the basic concepts and characteristics of the Python language and system. It is convenient to have an interpreter on hand to do experiments, but all examples are self-sufficient, so the guide can be read without being connected.

For standard module and object descriptions, see the Libraries Reference document. The Python Reference Manual provides a more formal definition of the language. To write extensions in C or C ++, read the Extension and Embedding and Reference Manuals in the Python / C API. There are also several books that deal with Python in detail. This guide does not attempt to be exhaustive or exhausting every Python capability, even the most commonly used ones. Instead, it introduces many of the capabilities that characterize Python and provides a clear idea of the style and flavor of the language. After reading it, the reader will be able to read and write modules and programs in Python and will be prepared to learn more about the various Python library modules described in the Libraries Reference.

Introduction

If you’ve ever written a script for a long UNIX shell script, you may know this feeling: You’d love to add one more feature, but it’s already so slow, so big, so complicated. . . Or the feature involves a system call or other function accessible only from C. The problem itself is not usually so complex as to transform the script into a program in C. Equally the program requires variable length strings or other data types ( Like sorted lists of filenames) easy in sh, but tedious in C. Or maybe it does not have as much looseness with C.

Another situation: You may have to work with various C libraries and the normal C-write-compile-test-recompile cycle is too slow. You need to develop software with more speed. Possibly you have written a program that would use an extension language and you do not want to design a language, write and debug the interpreter and adosarlo to the application.

In such cases, Python may be the language you need. Python is simple, but it is a real programming language. It offers more support and infrastructure for larger programs than the order interpreter. On the other hand, it also offers much more error checking than C and, being a very high level language, has high level data types, such as flexible arrays and dictionaries, which would take days of programming in C. Given their types of more general data, it can be applied to a wider range of problems than Awk or even Perl, but many things are at least as easy in Python as in those languages.

Python allows you to split your program into reusable modules from other Python programs. It comes with a large collection of standard modules that you can use as a basis for your programs (or as examples to start learning Python). There are also modules included that provide file I / O, system calls, sockets and even interfaces to IGU (Graphical User Interface) such as Tk.

Python is an interpreted language, which saves considerable time in the development of the program, since it is not necessary to compile or link. The interpreter can be used interactively, making it easy to experiment with language features, write disposable programs or test functions during the development of the core program up. It is also a very useful calculator.

Python lets you write very compact and readable programs. Programs written in Python are typically much shorter than their C or C ++ equivalents, for several reasons:

High-level data types allow you to express complex operations in a single statement.

The grouping of statements is done by indentation instead of begin / end or keys.

You do not need to declare arguments or variables.

Python is expandable: if you already know how to program in C, it is easy to add a new function or module to the interpreter, to perform critical operations at maximum speed or to link programs in Python with libraries that are only available in binary form (such as graphic libraries Manufacturer’s specifications). Once hooked, you can bind the Python interpreter to an application written in C and use it as a macro language for that application.

By the way, the name of the language comes from the BBC show “Monty Python’s Flying Circus” (Monty Python’s traveling circus) and has nothing to do with nasty reptiles. Making references to Monty Python sketches is not only allowed: it is recommended!

Where to go

Now that you’re excited about Python, you’ll want to look at it in more detail. As the best way to learn a language is to use it, from here we invite you to do so.

The mechanics of using the interpreter are explained in the next chapter. It is somewhat boring, but essential information to prove the later examples.

The rest of the guide presents several system and Python language features through examples, starting with simple expressions, statements and data types, through functions and modules, to end with a first look at advanced concepts such as exceptions and Classes defined by the user.

pythonlogo

10 reasons to learn Python

  1. Because it is easy to learn

Unlike many languages out there, Python has a very clean and easy to understand syntax that is like speaking the language to the machine instead of trying to understand machine language. Anyone can learn Python easily thanks to this and will feel comfortable working with it, even if it has never programmed anything in their life.

On the other hand, the interactive interpreter (Python Shell) has a pretty explanatory “Debugger” that practically shows you your error when you are wrong, exactly where it is and depending on what you use to write your code, almost the solution how to fix it.

  1. Because you will see results faster

In Python you write a line of code, you save it as a “.py” file and you already have a program done. It is a language that does not require compilation or many steps to start feeling like a “programmer” and will allow you to develop the most curious creations from your first lessons with only basic knowledge. Its syntax is less strict than other languages (like Java) and will allow you to do things that are not possible in some of the others, like changing the value of a variable “on the fly” inside your code “just because you want it “(Dynamic Typing).

If you want to learn a programming language with which, from the beginning you see CREATING THINGS, then learn Python.

  1. Because you can “specialize” in several things

Python lets you choose “paths” because you have mastered the basics of language well to good. Are you interested in object-oriented programming? You can become a Pythonist who writes object-oriented code. Are you interested in functional programming? You can write python focused on that type of programming, how about the imperative programming? With Python you have multiple paradigms to choose from.

  1. Because Google uses and recommends

The creator of Python, Guido Van Rossum works for Google and it is no wonder that thanks to this, most Google services have a Python backend behind them. Google actively supports the use of Python among programmers as it allows them to be productive in record time and do amazing things with few lines of code. You will find Python “wrappers” for all Google APIs, (or most) that dominate the web today.

  1. Because you can create Webapps, Desktop Apps and Shell Apps

Python is as simple as powerful. While you can easily code and create programs in record time, this does not mean that they are “going to have less joke” than those of more complicated languages. Python lets you create WHAT YOU IMAGINE. Do you want to make a web application stunning? With Python you can do it. Would you like to create a multiplatform desktop application? With Python you can do it. How about a Script in “shell” to automate some task or process of your system? You can also do it; you can do whatever you want!

Another advantage is that possibly something you want your application or project to do (some functionality or extra thing) it is possible that someone else has already implemented it in python and you can use its module to enrich your code, easy, fast And simple. With Python the limit REALLY is going to be your imagination and determination to create things.

  1. Because you can start faster and scale

Thanks to services like Google App Engine, any user can easily start using Python in a practical and real world environment, making (in that case) cloud web applications, testing results, playing with APIs, solving user needs. Do you need to climb? Make your code bigger? Python is so SCALABLE that working on it will not be a problem, on the contrary, it will be a pleasure.

  1. Because it comes pre-installed on Linux and MacOS

Python is a language so popular today that systems like MacOS and Linux bring it pre-installed since you buy your computer or install your distribution as the case. This on the user side (and / or aspiring programmer) helps to install python applications and test them more directly, (in addition to if you want to start faster in the world of programming with the language) Side of the programmer, with that you already have “covered” a fairly broad market share for your “PythonApps” (not specially “prepared” by platform for example) knowing that Linux and Mac users will have no major problem when trying Use them.

  1. Because it is easy to install in Windows

In the case of Windows, Python does not come pre-installed, but its installation is SO SIMPLE that no one would be complicated by anything in the world. Simply download the installer, do a “Next> Next>” and go! Like or easier?

  1. Because there is Ninja IDE

Every programmer knows that his best friend is the notebook and the console … But what happens when we are working on a big project or we just need the easiest things? Python has the BEST IDE I’ve ever seen in my life and it’s called Ninja-IDE: Open Source, Multiplatform and Super-friendly for both novice and advanced users. Know it and I promise you’ll like it a lot:

  1. Because it is Open Source

As the excellent programming language it is, Python is free code, which will allow you to not only create the best apps and stuff with it, but also INVOLVE YOURSELF IN YOUR SAME DEVELOPMENT! Python is for everyone and for all, and for that too, is that you should use it and choose it.

So, well, if your question is: Why should I learn Python? Here are 10 reasons …

Learning Resources:

 

Latest posts by pseudo code (see all)

Add Comment