Computer Science

Python

Python is a high-level, interpreted programming language known for its simplicity and readability. It is widely used for web development, data analysis, artificial intelligence, and scientific computing. Python's extensive standard library and large community make it a popular choice for beginners and experienced programmers alike.

Written by Perlego with AI-assistance

11 Key excerpts on "Python"

  • Book cover image for: Biocomputation and Biomedical Informatics
    Let us see what Python is in simpler terms. In a layman’s language it is a modern, general-purpose, object-oriented, high-level programming language. What makes such a popular language, is answered by observing the general characteristics of Python (basically two important features): • Clean and Simple Language: Python is easy-to-read and the coding is intuitive. In addition, it is easy-to-learn with minimalistic syntax. Very easy to maintain, scales well with varied size of projects. • Expressive Language: Most importantly, it requires very few lines of code, fewer bugs and easier to maintain. Debugging is also very easy. Let us now see the technical details, which characterize Python (basically three): • Dynamically Typed: In Python, there is no need to define the variable types, function arguments or return types. • Automatic Memory Management: Allocation and deallocation of memory for variables and data arrays is automatic in Python and the issue of memory leak bugs is minimal to null. Python: An Introduction to Scientific Computing 23 • Interpreted: No need to compile the code. The Python interpreter reads and executes the Python code directly. Let us look at some of the advantages and disadvantages of Python. First let us see the good side. • The primary reason for the popularity of Python is the ease of programming. This substantially minimizes the time needed to develop, debug and maintain the code. • Although borrowing from C++, Python is really well-designed language. It also encourages many good programming practices. • Like any other modern high-level programming language, Python is modular and supports object-oriented programming concepts. This is good for packaging and re-usage of the generated code. This often results in more transparent, maintainable and bug-free code. • The documentation is tightly integrated with the code, and follows a Linux like help system.
  • Book cover image for: Numerical Methods in Engineering with Python 3
    1 Introduction to Python 1.1 General Information Quick Overview This chapter is not a comprehensive manual of Python. Its sole aim is to provide suf- ficient information to give you a good start if you are unfamiliar with Python. If you know another computer language, and we assume that you do, it is not difficult to pick up the rest as you go. Python is an object-oriented language that was developed in the late 1980s as a scripting language (the name is derived from the British television series, Monty Python’s Flying Circus). Although Python is not as well known in engineering circles as are some other languages, it has a considerable following in the programming com- munity. Python may be viewed as an emerging language, because it is still being de- veloped and refined. In its current state, it is an excellent language for developing engineering applications. Python programs are not compiled into machine code, but are run by an interpreter. 1 The great advantage of an interpreted language is that programs can be tested and debugged quickly, allowing the user to concentrate more on the principles behind the program and less on the programming itself. Because there is no need to compile, link, and execute after each correction, Python programs can be developed in much shorter time than equivalent Fortran or C programs. On the negative side, interpreted programs do not produce stand-alone applications. Thus a Python pro- gram can be run only on computers that have the Python interpreter installed. Python has other advantages over mainstream languages that are important in a learning environment: • Python is an open-source software, which means that it is free; it is included in most Linux distributions. • Python is available for all major operating systems (Linux, Unix, Windows, Mac OS, and so on). A program written on one system runs without modification on all systems. 1 The Python interpreter also compiles byte code, which helps speed up execution somewhat. 1
  • Book cover image for: Data Science for Neuroimaging
    eBook - PDF
    Third, Python is a general-purpose language. In contrast to many other dynamic pro- gramming languages designed to serve specific niche uses, Python is well-suited for a wide range of applications. It features a comprehensive standard library (i.e., the function- ality available out-of-the-box when you install Python) and an enormous ecosystem of third-party packages. It also supports multiple programming paradigms to varying extents (object oriented, functional, etc.). Consequently, Python is used in many areas of sof- tware development. Very few other languages can boast that they have some of the best libraries implemented in any language for tasks as diverse as, say, scientific computing and back-end web development. Lastly, there is the sheer size of the Python community. While Python undeniably has many attractive features, we would not want to argue that it is a better overall programming language than anything else. To some degree, it is probably true that Python’s popular- ity is an accident of history. If we could randomly rerun the last two decades, we might be extolling the virtues of Haskell (or Julia, or Ruby, or. . .) instead of Python. So we are not saying Python is intrinsically the world’s greatest language. But there is no deny- ing that there are immense benefits to using a language that so many other people use. For most tasks you might want to undertake if you are doing data science and/or neu- roimaging data analysis, finding good libraries, documentation, help, and collaborators is simply going to be much easier if you work in Python than if you work in almost any other language. Importantly, the set of tools in Python specifically for the analysis of neuroimaging data have rapidly evolved and matured in the last couple of decades, and they have gained sub- stantial popularity through their use in research (we will dive into these tools in part 4 of the book).
  • Book cover image for: Introduction to Computing Using Python
    eBook - PDF

    Introduction to Computing Using Python

    An Application Development Focus

    • Ljubomir Perkovic(Author)
    • 2012(Publication Date)
    • Wiley
      (Publisher)
    8 Chapter 1 Introduction to Computer Science 1.3 Python Programming Language In this textbook, we introduce the Python programming language and use it to illustrate core computer science concepts, learn programming, and learn application development in general. In this section, we give some background on Python and how to set up a Python IDE on your computer. Short History of Python The Python programming language was developed in the late 1980s by Dutch programmer Guido van Rossum while working at CWI (the Centrum voor Wiskunde en Informatica in Amsterdam, Netherlands). The language was not named after the large snake species but rather after the BBC comedy series Monty Python’s Flying Circus. Guido van Rossum happens to be a fan. Just like the Linux OS, Python eventually became an open source soft- ware development project. However, Guido van Rossum still has a central role in deciding how the language is going to evolve. To cement that role, he has been given the title of “Benevolent Dictator For Life” by the Python community. Python is a general-purpose language that was specifically designed to make programs very readable. Python also has a rich library making it possible to build sophisticated ap- plications using relatively simple-looking code. For these reasons, Python has become a popular application development language and also the preferred “first” programming lan- guage. ! CAUTION Python 2 versus Python 3 There are currently two major versions of Python in use. Python 2 was originally made available in 2000; its latest release is 2.7. Python 3 is a new version of Python that fixes some less-than-ideal design decisions made in the early develop- ment of the Python language. Unfortunately, Python 3 is not backward compatible with Python 2. This means that a program written using Python 2 usually will not execute properly with a Python 3 interpreter. In this textbook, we have chosen to use Python 3 because of its more consis- tent design.
  • Book cover image for: Introduction to Computing Using Python
    eBook - PDF

    Introduction to Computing Using Python

    An Application Development Focus

    • Ljubomir Perkovic(Author)
    • 2015(Publication Date)
    • Wiley
      (Publisher)
    8 Chapter 1 Introduction to Computer Science 1.3 Python Programming Language In this textbook, we introduce the Python programming language and use it to illustrate core computer science concepts, learn programming, and learn application development in general. In this section, we give some background on Python and how to set up a Python IDE on your computer. Short History of Python The Python programming language was developed in the late 1980s by Dutch programmer Guido van Rossum while working at CWI (the Centrum voor Wiskunde en Informatica in Amsterdam, Netherlands). The language was not named after the large snake species but rather after the BBC comedy series Monty Python’s Flying Circus. Guido van Rossum hap- pens to be a fan. Just like the Linux OS, Python eventually became an open source software development project. However, Guido van Rossum still has a central role in deciding how the language is going to evolve. To cement that role, he has been given the title of “Benevolent Dictator for Life” by the Python community. Python is a general-purpose language that was specifically designed to make programs very readable. Python also has a rich library making it possible to build sophisticated ap- plications using relatively simple-looking code. For these reasons, Python has become a popular application development language and also the preferred “first” programming lan- guage. ! CAUTION Python 2 versus Python 3 There are currently two major versions of Python in use. Python 2 was originally made available in 2000; its latest release is 2.7. Python 3 is a new version of Python that fixes some less-than-ideal design decisions made in the early development of the Python language. Unfortunately, Python 3 is not backward compatible with Python 2. This means that a program written using Python 2 usually will not execute properly with a Python 3 interpreter. In this textbook, we have chosen to use Python 3 because of its more consistent design.
  • Book cover image for: Fundamentals of Machine Learning using Python
    • Euan Russano, Elaine Ferreira Avelino(Authors)
    • 2019(Publication Date)
    • Arcler Press
      (Publisher)
    Introduction to Python 1 CONTENTS 1.1. What Is Python ................................................................................... 2 1.2. What Makes Python Suitable For Machine Learning? .......................... 4 1.3. What Are Other Computational Tools For Machine Learning? ............. 5 1.4. How To Obtain And Configure Python? .............................................. 9 1.5. Scientific Python Software Set ........................................................... 11 1.6. Modules ........................................................................................... 14 1.7. Notebooks ........................................................................................ 15 1.8. Variables And Types .......................................................................... 16 1.9. Operators And Comparison .............................................................. 18 Fundamentals of Machine Learning using Python 2 1.1. WHAT IS Python Created in 1991 by Guido van Rossum and developed by Python Software Foundation, Python is a high-level, general-purpose programming language. High-level : Every programming language strongly focused on abstraction from the details of the computer is called a high-level language. It may use natural language elements and syntax to make the effort of developing a program simpler and more understandable when compared with low-level programming languages. Therefore, how high-level a programming language depends on the amount of abstraction that it incorporates. General-purpose : As the term indicates, a general-purpose programming language is designed to be used in a wide variety of fields and applications. This is only possible because the “architecture” of the language does not constrain it limiting to a specific application domain. The opposite of a general-purpose language is a domain-specific one, which is designed to be used within certain application domain.
  • Book cover image for: Mobile Applications Development
    eBook - ePub

    Mobile Applications Development

    With Python in Kivy Framework

    • Tarkeshwar Barua, Ruchi Doshi, Kamal Kant Hiran(Authors)
    • 2020(Publication Date)
    • De Gruyter
      (Publisher)
    1  Introduction of Python
    Python is an experiment in how much freedom programmers need. Too much freedom and nobody can read another’s code; too little and expressiveness is endangered. ~Guido Van Rossum

    1.1  Why Python

    Python is a very popular and widely used general-purpose interpreted programming language. It features a dynamic type of system and has automatic memory management with multiple programming paradigms including imperative, functional, and procedural. Programs can be created to automate various tasks. Nowadays, all major IT companies such as Google, Microsoft, and Apple, are using Python as the primary programming language. Python is the most accessible programming language to be learnt quickly in a short period. It can develop any application such as desktop, web application, mobile application, and utility tools, with the help of a wide range of frameworks and libraries available with minimum coding. It is free and open-source available with proper documentation over the Internet. Python focuses on business logic instead of the basic facts of programming. It is available in two versions 2.x and 3.x but primarily, the focus will be on 3.7 and the upcoming Python 3.8. Python 3.8 will be full of new features with its main emphasis on performance-related issues. Python is dynamically typed, automatically collects garbage, and manages memory with multiple programming paradigms such as procedural, object-oriented programming (OOP), and functional. Python is an agile language that allows the user to do many customized things within a short span of time. The application development can commence from any point of the module and, in the ending phase of application development, can join each other just before releasing.

    1.1.1  Drawbacks of Python

    All programming languages have some advantages and disadvantages. Python also has some disadvantages; some of them are listed as follows:
  • Book cover image for: Selenium and Appium with Python
    eBook - PDF

    Selenium and Appium with Python

    Build robust and scalable test automation frameworks using Selenium, Appium and Python (English Edition)

    Introduction Python is the most popular and widely used general-purpose, high-level object- oriented programming language, designed by Guido van Rossum and was released in 1991. In the modern software industry, Python is acclaimed for its enormous flexibility, readability, and adaptability features, present because of its simplified syntax and ease of learning. Python now has a vast community, support, and regular latest updates. Python is platform-independent and supports Mac, Windows, Linux, and various other operating systems. Python is versatile and applied in major programming use cases such as web applications, API development, Machine learning, Data Science, Big Data, Database, Artificial Intelligence, and so on. Python in Automation Testing, as well as the vast set of benefits and libraries that Python brings into testing, makes Python an extremely software automation testing friendly programming language. Its simple nature helps manual engineers migrate to automation and accomplish complex testing solutions. CHAPTER 2 Python Programming - Setup and Core Concepts 20  Selenium and Appium with Python Structure In this chapter, we will discuss the following topics: • Advantages of Python • Getting started with Python • The Python Interpreter • Executing the first Python Code • Virtual environment and Requirement.txt file • Core concepts of Python o Variables and data types o Types of operators in Python o Lists in Python o Tuples o Sets o Dictionaries o Conditional statements o Loops in Python • Functions in Python • Modules, packages, exception handling in Python • Classes and Objects in Python • Inheritance in Python Objectives This chapter will help us understand the basics of Python, from installation, setting up environment variables, requirement.txt file, to the concepts of code structure in Python with execution flow, writing Python programs, handling different variables, operators, expressions, and data types including Strings, and so on.
  • Book cover image for: Learn Web Development with Python
    No longer available |Learn more

    Learn Web Development with Python

    Get hands-on with Python Programming and Django web development

    • Fabrizio Romano, Gaston C. Hillar, Arun Ravindran(Authors)
    • 2018(Publication Date)
    • Packt Publishing
      (Publisher)
    So, you have all the objects you need; what now? Well, we need to use them, right? We may want to send them over a network connection or store them in a database. Maybe display them on a web page or write them into a file. In order to do so, we need to react to a user filling in a form, or pressing a button, or opening a web page and performing a search. We react by running our code, evaluating conditions to choose which parts to execute, how many times, and under which circumstances.
    And to do all this, basically we need a language. That's what Python is for. Python is the language we'll use together throughout this book to instruct the computer to do something for us. Now, enough of this theoretical stuff; let's get started. Passage contains an image

    Enter the Python

    Python is the marvelous creation of Guido Van Rossum, a Dutch computer scientist and mathematician who decided to gift the world with a project he was playing around with over Christmas 1989. The language appeared to the public somewhere around 1991, and since then has evolved to be one of the leading programming languages used worldwide today.
    I started programming when I was 7 years old, on a Commodore VIC-20, which was later replaced by its bigger brother, the Commodore 64. Its language was BASIC . Later on, I landed on Pascal, Assembly, C, C++, Java, JavaScript, Visual Basic, PHP, ASP, ASP .NET, C#, and other minor languages I cannot even remember, but only when I landed on Python did I finally have that feeling that you have when you find the right couch in the shop. When all of your body parts are yelling, Buy this one! This one is perfect for us!
    It took me about a day to get used to it. Its syntax is a bit different from what I was used to, but after getting past that initial feeling of discomfort (like having new shoes), I just fell in love with it. Deeply. Let's see why.
  • Book cover image for: UNIX
    eBook - PDF

    UNIX

    The Textbook, Third Edition

    • Syed Mansoor Sarwar, Robert M. Koretsky(Authors)
    • 2016(Publication Date)
    We make some commentary on this here, and illustrate some simple uses of the models in the next few sections. 588 ◾ UNIX: The Textbook, Third Edition Python is a high-level , structured (in this case, this means built of regular components), and interpreted programming (or scripting) language, as opposed to a low-level, compiled language like C or Java. As stated, it is also a multiparadigm programming language, which allows you to use data abstractions from the three predominant paradigms. For our pur-poses, “scripting” and “programming” can be thought of as the same thing. 16.1.1 Python Program Data Model Even though Python is a multiparadigm programming language, its actual basis is the following: Everything in a Python program can be referred to as an object , with the same exact meaning of the word object in OOP. These objects have three parts: an identifier , a type , and a value . For example, when you assign X = 62.25 interactively in the Python interpreter, or in a Python module, script file, or library of modules, a real number object type is created; it has a value of 62.25, and it is identified as an object with a pointer to its location in memory. X is the identifier that refers to its specific location in memory. In OOP languages such as Python and Java, the type that an object assumes gives it membership in a particular set, called its class . The class of the object limits and also defines, in a fashion, what are known as the methods , or operations, which can be performed on or with it. When a particular object of some type is created, that particular object is called an instance of that type. In general, an object’s identity and type cannot be changed. They are known as immutable . If an object’s value can be modified, the object is said to be mutable . An object that refers to other objects to obtain value and type is known as a container .
  • Book cover image for: Python for Scientists
    1 Introduction The title of this book is “Python for Scientists”, but what does that mean? The dictio- nary defines “Python” as either (a) a non-venomous snake from Asia or Saharan Africa or (b) a computer scripting language, and it is the second option which is intended here. (What exactly this second definition means will be explained later.) By “scientist”, I mean anyone who uses quantitative models either to obtain conclusions by processing pre-collected experimental data or to model potentially observable results from a more abstract theory, and who asks “what if?”. What if I analyse the data in a different way? What if I change the model? Thus the term also includes economists, engineers and mathematicians among others, as well as the usual concept of scientists. Given the vol- ume of potential data or the complexity (non-linearity) of many theoretical models, the use of computers to answer these questions is fast becoming mandatory. Advances in computer hardware mean that immense amounts of data or ever more complex models can be processed at increasingly rapid speeds. These advances also mean reduced costs so that today virtually every scientist has access to a “personal computer”, either a desktop work station or a laptop, and the distinction between the two is narrowing quickly. It might seem to be a given that suitable software will also be available so that the “what if” questions can be answered readily. However, this turns out not always to be the case. A quick pragmatic reason is that, while there is a huge market for hardware improvements, scientists form a very small fraction of it and so there is little financial incentive to improve scientific software. But for scientists, this issue is important and we need to examine it in more detail. 1.1 Scientific Software Before we discuss what is available, it is important to note that all computer software comes in one of two types: proprietary and open-source.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.