
Teach Yourself VISUALLY Python
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Teach Yourself VISUALLY: Python is your personal guide to getting you started in programming. As one of the world's most popular--and most accessible--coding languages, Python is your gateway into the wide and wonderful world of computer science. This hands-on guide walks you through Python step by clearly illustrated step, from writing your very first Python code in a terminal window or the VS Code app through to creating your own lists, dictionaries, and custom classes.
In the book, you'll learn to:
* Install Python and the tools you need to work with it on Windows, macOS, and Linux
* Work with files and folders, manipulate text, and create powerful functions that do exactly what you want
* Write clean code that makes decisions effectively, repeats actions as needed, and handles any errors that occur
A must-have resource for aspiring programmers starting from the very beginning, Teach Yourself VISUALLY: Python is also an indispensable handbook for programmers making a transition from another language.
More details
Other editions
Additional editions

Content
CHAPTER 1
Getting Ready to Work with Python
In this chapter, you learn what Python is and get ready to work with it. You choose the version of Python that suits your needs and then install that version if your computer does not already have it. You also install and configure your main tool for working with Python, a powerful code editor/integrated development environment called Visual Studio Code.
Understanding What Python Is and Does
Choose the Right Version of Python
Install Python on Linux If Necessary
Learn About Development Tools for Python
Download and Install Visual Studio Code
Get Started with Visual Studio Code and Apply a Theme
Install Visual Studio Code Extensions for Python
Configure Visual Studio Code for Working with Python
Understanding What Python Is and Does
Python is a programming language that is used both widely and for many different purposes. Python enables you to write applications that work on many different computing platforms, including Microsoft Windows, Apple's macOS, and Linux. Python is especially useful for automating routine tasks, thus enabling yourself and your colleagues to get more work done in less time.
A Dutch programmer named Guido van Rossum began work on Python in the late 1980s, eventually releasing the first version as Python 0.9.0 in 1991. Since 2001, Python has been run by a U.S.-based nonprofit organization called the Python Software Foundation.
Understanding What Python Is
A programming language is a type of computer language that is used to implement algorithms, which are instructions for performing particular actions - in other words, to make the computer do what the programmer wants it to do.
Python is a general-purpose programming language rather than a domain-specific programming language. As you might guess, a general-purpose programming language is a programming language designed for general programming use rather than for use in a specific area of computing. By contrast, a domain-specific programming language is a programming language designed for use in a specific area of computing. For example, Wolfram Mathematica is a programming language designed for symbolic mathematics; it is not designed for, and is not suitable for, general programming use, so it is domain specific.
Understanding Cross-Platform Programming
Python enables you to write applications that work on many different computing platforms. A computing platform means the hardware and operating system that together constitute a functional computer.
This book covers three widely used computing platforms:
- PC hardware running Microsoft's Windows operating system. This book uses Windows 10 and Windows 11 for examples.
- Apple Macintosh hardware running Apple's macOS operating system. This book uses macOS version 12, also known as macOS Monterey, for examples.
- PC hardware running the Linux operating system. Linux comes in many different versions, called distributions. This book uses the popular Ubuntu distribution for Linux examples.
Python fully supports the Windows, Mac, and Linux platforms, but it also supports many other platforms. These platforms range from those for personal devices, such as Apple's iOS operating system and iPhones, all the way up to "big-iron" platforms for minicomputers and mainframes, such as IBM's AIX and HP's HP-UX. Python versions for some platforms come from third-party vendors.
Understanding Who Uses Python
Many different types of programmers use Python. Here are two examples:
- Web developers use Python to create web services that provide custom information in response to requests they receive. For example, when you visit a web forum, Python may be generating some or all parts of the page that the server sends to your browser.
- Scientists, mathematicians, and engineers across many fields use Python to perform data analysis, because Python provides powerful and convenient tools for processing and applying complex equations to statistical data.
Know Where You Can Get Python
You can download Python for free from the Python Software Foundation's website, www.python.org. However, you may not need to download Python, because it may already be installed on your computer.
Windows typically does not include Python; see the section "Install Python on Windows," later in this chapter, for instructions on installing Python.
macOS includes Python 2. See the section "Install Python on the Mac," later in this chapter, for instructions on seeing which version a Mac contains and updating Python if necessary.
Many Linux distributions include one or more versions of Python. As of this writing, more distributions include Python 2 than include Python 3, but some distributions include both versions; see the following section, "Choose the Right Version of Python." See the section "Install Python on Linux If Necessary," later in this chapter, for instructions on checking the version and updating if necessary.
To find versions of Python for iOS or iPadOS, open the App Store app on the iPhone or iPad and search for python. Pythonista is a popular app, but there are plenty of other choices. Similarly, to find versions of Python for Android, open the Play Store app on your Android device and search for python.
Choose the Right Version of Python
As of this writing, two major versions of Python are in use: Python 2 and Python 3. Before you download and install Python on your computer, you should determine which version of Python will be best for your needs. This will most likely be Python 3, because Python 2 is out of date and the Python Software Foundation no longer supports it.
This section explains what you need to know about Python 2 and Python 3. It also explains the two types of Python builds that are available - stable builds and development builds - and advises you which build type to get.
Understanding Python 2 and Python 3
Two major versions of Python are currently in wide use: Python 2, released in 2000, and Python 3, released in 2008.
Each version uses a sequence-based numbering scheme for intermediate releases. For example, "Python 2.7.1" means Python 2, the seventh minor version, and the first update to that minor version. Similarly, "Python 3.10.0" means Python 3, the tenth minor version, and the initial release of that minor version.
The Python Software Foundation officially discontinued, or "sunset," Python 2 on January 1, 2020. Sunsetting means that the Python Software Foundation will not develop Python 2 any further, even if researchers discover serious security issues in it. Because Python 2 has been sunset, the Python Software Foundation recommends that all users upgrade to Python 3 as soon as possible. The final version of Python 2 was 2.7.18.
With most software, such as business productivity apps or multimedia apps, upgrading to a newer version is a straightforward and painless procedure: You upgrade to the new version, and everything still works, even if the user interface has changed and the new version of the app provides extra features.
Python 3 offers compelling new features that Python 2 does not have; even better, Python 3 typically runs faster than Python 2. However, Python 3 is not fully compatible with Python 2, and some Python 2 code may not run successfully in Python 3. This is why many companies and organizations still have not upgraded from Python 2 to Python 3. The more Python 2 code a company or organization has built up, the more time, effort, and expense it will take to upgrade to Python 3.
Which Version of Python Do You Need?
You almost certainly need Python 3 unless your workplace uses Python 2 and is not migrating to Python 3. For example, your employer may have developed substantial amounts of Python 2 code that is not fully compatible with Python 3 and may therefore be sticking with Python 2.
If you are planning to start developing code from scratch, you should definitely choose Python 3 rather than Python 2.
You can install both Python 2 and Python 3 alongside each other and use each version when you need it.
macOS and many Linux distributions include Python 2 because they require Python 2 to run some software packages included with the operating system or distribution. Because of this requirement, you should not uninstall Python 2, even if you do not need it. Instead, simply leave Python 2 alone, install Python 3, and use Python 3 for development.
Windows does not need Python 2, so normally, you should install Python 2 on Windows only if you need it.
What Are the Two Build Types of Python?
Python.org makes available two types of builds of Python, stable builds and development builds:
Stable build. A stable build is a build that has been fully tested and approved for distribution.
Development build. A development build is an experimental build used for testing and compatibility. Development...
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.