Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Python Essentials For Dummies -  Alan Simpson

Python Essentials For Dummies (eBook)

(Autor)

eBook Download: EPUB
2024 | 1. Auflage
192 Seiten
For Dummies (Verlag)
978-1-394-26349-3 (ISBN)
Systemvoraussetzungen
12,99 inkl. MwSt
(CHF 12,65)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

The no-nonsense way to get started coding in the Python programming language

Python Essentials For Dummies is a quick reference to all the core concepts in Python, the multifaceted general-purpose language used for everything from building websites to creating apps. This book gets right to the point, with no excess review, wordy explanations, or fluff, making it perfect as a desk reference on the job or as a brush-up as you expand your skills in related areas. Focusing on just the essential topics you need to know to brush up or level up your Python skill, this is the reliable little book you can always turn to for answers.

  • Get a quick and thorough intro to the basic concepts of coding in Python
  • Review what you've already learned or pick up essential new skills
  • Create websites, software, machine learning, and automation for school or work
  • Keep this concise reference book handy for jogging your memory as you code

This portable Dummies Essentials book focuses on the key topics you need to know about the popular Python language. Great for supplementing a course, reviewing for a certification, or staying knowledgeable on the job.

John C. Shovic, PhD, is a computer science faculty member specializing in robotics and artificial intelligence at the University of Idaho.

Alan Simpson is a web development professional and prolific tech author with more than 100 publications to his credit.

Chapter 1

Starting with Python


IN THIS CHAPTER

Discovering why Python is hot

Finding the tools for success

Writing Python in VS Code

Because you’re reading this chapter, you probably realize that Python is a great language to know if you’re looking for a good job in programming, or if you want to expand your existing programming skills into exciting cutting-edge technologies such as artificial intelligence (AI), machine learning (ML), data science, or robotics, or even if you’re just building apps in general. So we’re not going to try to sell you on Python. It sells itself.

Our approach leans heavily toward the hands-on. A common failure in many programming tutorials is that they already assume you’re a professional programmer in some language, and they skip over things they assume you already know.

This book is different in that we don’t assume that you’re already programming in Python or some other language. We do assume that you can use a computer and understand basics such as files and folders.

We also assume you’re not up for settling down in an easy chair in front of the fireplace to read page after page of theoretical stuff about Python, like some kind of boring novel. You don’t have that much free time to kill. So we’re going to get right into it and focus on doing, hands-on, because that’s the only way most of us learn. We’ve never seen anyone read a book about Python and then sit at a computer and write Python like a pro. Human brains don’t work that way. We learn through practice and repetition, and that requires being hands-on.

Why Python Is Hot


We promised we weren’t going to spend a bunch of time trying to sell you on Python, and that’s not our intent here. But we would like to talk briefly about why it’s so hot.

Here are the main reasons cited for Python’s current popularity:

  • Python is relatively easy to learn.
  • Everything you need to learn (and do) in Python is free.
  • Python offers more ready-made tools for current hot technologies such as data science, machine learning, artificial intelligence, and robotics than most other languages.

Choosing the Right Python


There are different versions of Python out roaming the world, prompting many a beginner to wonder things such as

  • Why are there different versions?
  • How are they different?
  • Which one should I learn?

All good questions, and we’ll start with the first. A version is kind of like a car year. You can go out and buy a 1968 Ford Mustang, a 1990 Ford Mustang, a 2019 Ford Mustang, or a 2020 Ford Mustang. They’re all Ford Mustangs. The only difference is that the one with the highest year number is the most current Ford Mustang. That Mustang is different from the older models in that it has some improvements based on experience with earlier models, as well as features current with the times.

Programming languages (and most other software products) work the same way. But as a rule, we don’t ascribe year numbers to them because they’re not released on a yearly basis. They’re released whenever they’re released. The principle is the same, though. The version with the highest number is the newest, most recent model, sporting improvements based on experience with earlier versions, as well as features relevant to the current times.

In this book, we focus on versions of Python that are current in late 2023 from Python 3.11 and higher. Don’t worry about version differences after the first and second digits. Version 3.11.1 is similar enough to version 3.11.2 that version differences aren’t important, especially to a beginner. Most of what’s in Python is the same across all recent versions. So you need not worry about investing time in learning a version that is or will soon be obsolete.

Tools for Success


Now we need to start getting your computer set up so that you can learn, and do, Python hands-on. For one, you’ll need a good Python interpreter and editor. The editor lets you type the code, and the interpreter lets you run that code. When you run (or execute) code, you’re telling the computer to “do whatever my code tells you to do.”

The term code refers to anything written in a programming language to provide instructions to a computer. The term coding is often used to describe the act of writing code. A code editor is an app that lets you type code, in much the same way an app such as Microsoft Word or Apple Pages helps you type regular, plain-English text.

Just as there are many brands of toothpaste, soap, and shampoo in the world, there are many brands of code editors that work well with Python. There isn’t a right one or a wrong one, a good one or a bad one, a best one or a worst one. Just a lot of different products that basically do the same thing but vary slightly in their approach and what that editor’s creators think is good.

If you’ve already started learning Python and are happy with whatever you’ve been using, you’re welcome to continue using that and ignore our suggestions. If you’re just getting started with this stuff, we suggest you use VS Code, because it’s an excellent, free learning environment.

Installing Python and VS Code


The editor we recommend and will be using in this book is called Visual Studio Code, officially. But most often, it is spoken or written as VS Code. The main reasons why it’s our favorite follow:

  • It is an excellent editor for learning coding.
  • It is an excellent editor for writing code professionally and is used by millions of professional programmers and developers.
  • It’s relatively easy to learn and use.
  • It works pretty much the same on Windows, Mac, and Linux.
  • It’s free.
  • It integrates beautifully with GitHub Copilot, so you can use modern, generative AI to speed both learning and actual coding.

To use VS Code as your editor for learning and doing Python, you need to download and install Python, VS Code, and a VS Code extension. With luck, you already have some experience working with apps, so this won’t be difficult. You will have to follow onscreen instructions as you go along. If faced with any choices you’re not sure about along the way, you can just choose the default (suggested) option. Here are the steps to download and install Python and VS Code:

  1. Use any web browser to browse to www.python.org.
  2. Click Download and, if asked to select a version, choose the suggested stable version.
  3. Open the folder to which you downloaded Python and double-click the icon for the file you downloaded to install Python.

    You can just follow the onscreen instructions, and accept any suggested defaults, during the installation process.

  4. Browse to https://code.visualstudio.com/ and download the current version of VS Code for your operating system.
  5. Open the folder to which you downloaded Visual Studio code, double-click the icon for the downloaded file, and follow the onscreen instructions to install VS Code.

After VS Code is installed, you should be able to start it like any other app in your system. In Windows, click Start and look around on the Start menu for Visual Studio Code icon. On a Mac, you should be able to find it in your Applications folder, or Launchpad.

Installing the Python extension


To use VS Code for Python coding, you need to install the VS Code Python extension for Python. When you open VS Code, you will see some icons listed down the left side of the window. Placing the mouse cursor over any icon reveals its name. Click the Extensions icon, shown in Figure 1-1, and then enter Python in the Search box at the top of the Extensions panel. Click the Install button with the Python extension from Microsoft (see Figure 1-1).

FIGURE 1-1: Obtaining the Python extension in VS Code.

When you’ve finished installing the Python extension, you might notice that both Python and Pylance were added as extensions to VS Code. Don’t worry; that’s normal. Pylance just gives you some additional capabilities that make it easier to learn and write Python code within the VS Code editor. To ensure that the extension is activated, exit VS Code and then restart it.

Letting AI write your Python code


Modern generative AI is perfectly capable of writing Python code for you. It’s not as simple as commanding it to “Write a Python app that will make me a billionaire,” however. It doesn’t work that way — yet. Unfortunately. You need to break things down into smaller chunks, and probably use accurate tech terminology, too. In other words, you still have to learn enough Python to be able to write your AI prompts accurately. Virtually all of these prompts — no matter which AI service you use — will start with “Write python code for …” because AI can do a lot of things. If you don’t tell it, specifically, that you want it to write Python code, you might get no code, HTML, JavaScript, or whatever. So...

Erscheint lt. Verlag 27.3.2024
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
ISBN-10 1-394-26349-X / 139426349X
ISBN-13 978-1-394-26349-3 / 9781394263493
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Adobe DRM)

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Entwicklung von GUIs für verschiedene Betriebssysteme

von Achim Lingott

eBook Download (2023)
Carl Hanser Verlag GmbH & Co. KG
CHF 38,95
Das umfassende Handbuch

von Johannes Ernesti; Peter Kaiser

eBook Download (2023)
Rheinwerk Computing (Verlag)
CHF 43,85
Mit über 150 Workouts in Java und Python

von Luigi Lo Iacono; Stephan Wiefling; Michael Schneider

eBook Download (2023)
Carl Hanser Verlag GmbH & Co. KG
CHF 29,30