Python is a high-level programming language that is designed to be versatile and applicable to various tasks. Being a high-level languageA programming language that provides abstractions and features to simplify coding compared to lower-level languages. means that it provides abstractions and features that make it easier for programmers to write code compared to lower-level languages. Python's design philosophy emphasizes code readabilityA design philosophy emphasizing clear and understandable code structure in Python., which means that the code is structured in a way that is easy to understand and follow.
One distinctive feature of Python is its use of significant indentationPython's use of indentation to define code blocks, enforcing a consistent and readable structure.. This means that the indentation of code blocks using spaces or tabs is not just for aesthetics but has semantic meaning. The off-side ruleThe principle behind significant indentation, ensuring a consistent and readable code structure., which is the principle behind this indentation style, enforces a consistent and readable structure in the code.
Python's language constructs and its support for object-oriented programming (OOP) help developers write code that is clear and logically organized. OOP is a programming paradigm that structures code around objects, which are instances of classes containing data (attributes) and behavior (methods). This approach promotes modular and reusable code.
Python is dynamically typedVariable types are inferred at runtime, providing flexibility in programming., which means that variable types are inferred at runtime rather than being explicitly declared. This allows for flexibility in programming and makes it easier to write and modify code. Additionally, Python has garbage collectionAn automatic memory management feature in Python, handling memory allocation and deallocation., which automatically manages memory allocation and deallocation, making it more convenient for programmers as they don't have to manually manage memory.
Python supports multiple programming paradigmsApproaches to programming styles, including structured, object-oriented, and functional programming., including structured (procedural), object-oriented, and functional programming. This means that developers can choose the paradigm that best suits their needs and combine different approaches within the same codebase.
Python is often referred to as a "batteries includedPython's comprehensive standard library providing pre-built functionality for various tasks." language because it comes with a comprehensive standard library. The standard library provides a wide range of modules and packages that offer pre-built functionality, making it easier to accomplish various tasks without having to write code from scratch. This feature enhances productivity and reduces the time required to develop applications.
Overall, Python's design choices, including its readability, support for different programming paradigmsApproaches to programming styles, including structured, object-oriented, and functional programming., and extensive standard library, aim to enable programmers to write clear and concise code for both small and large-scale projects.
Python has a large and active communityA group of users and developers actively involved in using and improving Python. of users and developers. It is used in a wide variety of domains, including web development, data science, machine learning, artificial intelligence, and scientific computing.
Here are some of the benefits of using Python:
Here are some of the things you can do with Python:
The Python programming language was created in the late 1980s by Guido van RossumThe creator of the Python programming language. at Centrum Wiskunde & Informatica (CWI) in the Netherlands. Van Rossum was looking for a new programming language that was easy to learn and use, and that was also powerful and versatile. He was inspired by the ABC programming language, and he wanted to create a language that was even better.
Van Rossum began working on Python in December 1989, and the first release of the language was made available in February 1991. Python has since become one of the most popular programming languages in the world, and it is used by a wide range of people, from students and hobbyists to professional developers.
Here is a brief history of Python:
Here are some specific stats as of January 2021 on Python usage and growth:
Check out this chart showing Python's growth relative to some of the other more popular languages in recent years:
This image is from the linked article on the Stack Overflow blog - Click here to read more
To install Python on a Windows computer, you can follow these steps:
To install Python on an Apple computer (Mac), you can follow these steps:
You could create Python programs using some of the basic tools that are on your computer. However, it is strongly recommended that you download and use what's called an IDE, or Integrated Development Environment. An IDE helps you create Python scripts in less time and with fewer errors by helping you out in a number of ways. You can choose from several different IDEs available for your computer, but I will tell you that my favorite is a program called PyCharm.
PyCharm does a lot of things for you that would normally be much more difficult or time consuming. It also provides you with tools like a debugger, and it highlights problems in your code so you can fix them more easily.
Check out this video tour for more information on what PyCharm can do for you:
The best part about it is that PyCharm comes in a free-to-use version, called “Community Edition”, that does most of what you will need to do in order to get through the modules of this class. If you are a student with an accredited institution, you can also get a free license for the “Pro” version, which has more bells and whistles than most people will ever need.
Check out more information on these IDEs on the JetBrains web page
Below, you should see a mostly empty window. It's called a Jupyter Notebook, and you will see these throughout this textbook. These windows allow you to try out code in a safe place, right as you are learning about specific coding principles in Python. It won't replace an IDE like PycharmAn IDE for Python development, offering features like debugging and code highlighting., but it will work just fine for simple things.
Here are a few things to remember in these notebooks:
Let's try a very basic program by typing the following code into the notebook below and pressing SHIFT-ENTER:
print("Hello, World!")
When you run your code, you should see something like this in the window:
If you did, then you are well on your way to mastering Python!
The next step is to try the same code in your IDE. To do this in PyCharmAn IDE for Python development, offering features like debugging and code highlighting., follow the steps below.
To run a "Hello World" program in PyCharm, you can follow these steps:
Congratulations! You have successfully run a "Hello World" program in PyCharm. This simple program serves as a starting point for testing your PyCharm installation and ensuring that everything is working correctly. From here, you can explore and build more complex Python projects using PyCharm's features and functionalities.
Batteries included | Python's comprehensive standard library providing pre-built functionality for various tasks. |
Code readability | A design philosophy emphasizing clear and understandable code structure in Python. |
Community | A group of users and developers actively involved in using and improving Python. |
Community Edition | A free version of PyCharm for basic Python development. |
Dynamically typed | Variable types are inferred at runtime, providing flexibility in programming. |
Garbage collection | An automatic memory management feature in Python, handling memory allocation and deallocation. |
Guido van Rossum | The creator of the Python programming language. |
High-level language | A programming language that provides abstractions and features to simplify coding compared to lower-level languages. |
Integrated Development Environment (IDE) | Software that assists in writing and managing code, recommended for Python development. |
Object-oriented programming (OOP) | A programming paradigm structuring code around objects with attributes and methods, promoting modular and reusable code. |
Off-side rule | The principle behind significant indentation, ensuring a consistent and readable code structure. |
Pro version | A paid version of PyCharm with additional features, available for free to students from accredited institutions. |
Programming paradigms | Approaches to programming styles, including structured, object-oriented, and functional programming. |
PyCharm | An IDE for Python development, offering features like debugging and code highlighting. |
Python history | A timeline of major releases and milestones in the development of Python. |
Significant indentation | Python's use of indentation to define code blocks, enforcing a consistent and readable structure. |
Stack Overflow Developer Survey | An annual survey indicating Python's popularity and usage statistics among developers. |
Test your knowledge of this module by choosing options below. You can keep trying until you get the right answer.
Skip to the Next Question