Showing posts with label advantagea of python.dis advantagea of python. Show all posts
Showing posts with label advantagea of python.dis advantagea of python. Show all posts

To the student: Why Python?

                                To the student: Why Python?

                               Given so many other programming languages in the world, why should you learn Python as your first exposure to computer programming? Well, the real answer is that your instructor selected the both the language and this textbook for the course, so what choice do you have? Nonetheless, let me explain why this was a very good decision.Python is easy, Python is fun, Python is educational, and Python is powerful.
                          Let’s start with the powerful. If you look at the case studies toward the end of the session, you will see that you will end up learning how to do some very interesting things. Tasks like writing your own blog, automatically solving soduko puzzles, reading your iTunes database, or writing a wiki. None of these take more than a page or two of Python code.
                        This is considerably smaller than the equivalent programs would be in almost any other programming language. Is it easy? Let me fudge and say it is easier. Computer programming in any language takes skill, organization, logic, and patience. Python is no different in this regard. What makes Python attractive is that you can begin so quickly and easily. Your first Python
program can be as simple as 2 + 3:
>>> 2 + 3
5
Thereafter the path to learning how to create your own complex applications is, we hope, at least clearly laid out, even if it will take some effort on your part.
Active Learning:                                 
                               This session  follows an attitude towards teaching that has been termed active learning. Rather than treating you, the student, as a passive repository into which knowledge is poured, active learning tries to engage you, the student, as a fully equal partner in the process of learning. Rather than simply telling you how some feature works, I will usually suggest experiments that you can perform to discover the answer on your own. 
                                          There are several benefits to this approach. First, it makes you use a different part of your brain than you would if you were simply reading. Second, it gives you, the student, a greater sense of ownership of the knowledge. Third, experimentation is often the fun part of programming. Lastly, by encouraging you to experiment in the discovery of simple information, I hope to instill habits that you will continue to carry with you throughout your programming career. Together, the intent is that active learning helps you more easily retain and use the information you have learned.


what is python

                what is python

                                                   For those looking for buzzwords, Python is a high-level, interpreted, reflective, dynamically-typed, open-source, multi-paradigm, general-purpose programming language. I could explain each of those terms in detail, but in the end the result would still not convey what makes Python programming different from other languages. There is no one thing in Python that is not found in other languages, but it is the elegant design and combination of these features into a single package that makes Python such a pleasure to use.
                    Python is sometimes described as a scripting language, for the simple reason that thousands of working programmers daily use the language in this fashion. That is, they use Python as a tool to quickly and easily glue together software applications and components written in many different languages. But such a categorization is far too narrow, and Python can justly be described as a general-purpose language, one that can you can use for almost any programming task you would like to perform.
                      This is not to say that Python is the only programming language you will ever need or will ever learn. A working computer scientist should know how to use many different tools, and that means he or she should have an appreciation of many different types of language. For example, because Python is interpreted, the resulting programs are often not as fast as those written in lower-level languages, such as C or C++.
                     On the other hand, programs are much easier to write than they are in C. So there is a trade-off, anengineering compromise of the type common in computer science. Is less time in execution of the final program worth spending more time in development and debugging? For the beginning student, and in fact for the vast majority of computer programs, the answer is clearly no. (Another way to express this trade-off is to ask, “whose time is more important, your time or the computer’s?”) Low-level languages such as C have their place, but only for the small group of computer programs for which ultimate execution time is critically important. You may eventually work on such systems, but not in your first programming course.
              Another important category of programming languages are those tied to a specific application. A good example of this category is the language PHP, a programming language used to create interactive web pages. (See www.php.org). A general-purpose language, such as Python, cannot hope to be as easy to use in this application area. But PHP is extremely clumsy to use for purposes other than web pages. If, or when, you start extensive work in such an application area you will want to learn how to use these tools


How to install Python

                  installation Python

                               For Python programming you need a working Python installation and a text editor. Python comes with its own editor IDLE, which is quite nice and totally sufficient for the beginning. As you get more into programming, you will probably switch to some other editor like emacs, vi or another.
                      The Python download page is http://www.python.org/download. The most recent version is 3.1, but any Python 2.x version since 2.2 will work for this tutorial. Be careful with the upcoming Python 3, though, as some major details will change and break this tutorial's examples. A version of this tutorial for Python 3 is at Non-Programmer's Tutorial for Python 3. There are various different installation files for different computer platforms available on the download site. Here are some specific instructions for the most common operating systems:

Linux, BSD and Unix users: 

                     You are probably lucky and Python is already installed on your machine. To test it type python on a command line. If you see something like that in the following section, you are set.If you have to install Python, just use the operating system's package manager or go to the repository where your packages are available and get Python. Alternatively, you can compile Python from scratch after downloading the source code. If you get the source code make sure you compile in the Tk extension if you want to use IDLE.

Mac users :

                  Starting from Mac OS X (Tiger), Python ships by default with the operating system, but you might want to update to the newer version (check the version by startingpython in a command line terminal). Also IDLE (the Python editor) might be missing in the standard installation. If you want to (re-)install Python, have a look at theMac page on the Python download site.

Windows users 

                Some computer manufacturers pre-install Python. To check if you already have it installed, open command prompt (cmd in run menu) or MS-DOS and type python. If it says "Bad command or file name" you will need to download the appropriate Windows installer (the normal one, if you do not have a 64-bit AMD or Intel chip). Start the installer by double-clicking it and follow the procedure.