Book description
A simple, straightforward, and hands-on roadmap to the world of computer programming with Python
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.
Table of contents
- Cover
- Title Page
- Copyright
-
Chapter 1: Getting Ready to Work with Python
- Understanding What Python Is and Does
- Choose the Right Version of Python
- Install Python on Windows
- Install Python on the Mac
- 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
-
Chapter 2: Writing and Running Your First Python Code
- Understanding the main() Function
- Create and Save a New Script in Visual Studio Code
- Write and Run Code in Visual Studio Code
- Execute Python Commands in a Terminal Window
- Run a Python Script in a Terminal Window
- Understanding Comments in Python
- Add Comments to Your Code
- Grasp Importing Modules and Objects
- Import Modules and Use Their Methods
-
Chapter 3: Getting Started with Variables
- Understanding Variables and Their Usage
- Understanding Python’s Data Types
- Work with Integers
- Work with Floating-Point Values
- Work with Boolean Values
- Work with Tuples
- Work with Sets
- Start Working with Strings
- Start Working with Lists
- Start Working with Dictionaries
- Convert Data from One Type to Another
-
Chapter 4: Working with Files and Directories
- Understanding Working with Files and Directories
- Load the os Module and List Files and Directories
- Navigate Among Directories
- Create and Delete Directories
- Rename, Move, and Copy Files and Directories
- Get Information About the User and System
- Split a File Path into Its Components
- Understanding Python’s open() Function
- Understanding Python’s Ways of Closing Files
- Open a File If It Exists; If Not, Create It
- Check an Open File’s Status and Close It
- Write Data to a File
- Open a File for Both Reading and Writing
- Append Data to a File
- Read a Text File
-
Chapter 5: Working with Python’s Operators
- Meet the Arithmetic Operators
- Work with the Arithmetic Operators
- Meet the Assignment Operators
- Work with the Assignment Operators
- Meet the Comparison Operators
- Work with the Comparison Operators
- Meet the Logical Operators
- Work with the Logical Operators
- Meet the Identity Operators
- Work with the Identity Operators
- Meet the Membership Operators
- Work with the Membership Operators
- Meet the Bitwise Operators
- Work with the Bitwise Operators
-
Chapter 6: Making Decisions with if Statements
- Learn the Essentials of if Statements
- Understanding the if Statement
- Create an if Statement
- Understanding the if… else Statement
- Create an if… else Statement
- Understanding the if… elif Statement
- Create an if… elif Statement
- Understanding the if… elif… else Statement
- Create an if… elif… else Statement
- Understanding Nested if Statements
- Create Nested if Statements
-
Chapter 7: Repeating Actions with Loops
- Understanding Python’s Loops
- Understanding How for Loops Work
- Create for Loops
- Understanding How while Loops Work
- Create while Loops
- Understanding break Statements in Loops
- Using a break Statement to Exit a Loop Early
- Understanding continue Statements in Loops
- Using a continue Statement in a Loop
- Understanding else Statements in Loops
- Using an else Statement in a Loop
- Understanding Loop Nesting
- Nest Loops to Create Complex Repetition
-
Chapter 8: Working with Functions
- Understanding Functions and Their Syntax
- Understanding Function Parameters and Returns
- Using Python’s Built-In Functions
- Create a Function with Parameters and a Return
- Create a Function with a Parameter But No Return
- Create a Function with No Parameters But a Return
- Create a Function with No Parameters and No Return
- Create a Function That Returns Multiple Values
- Create a Function with Optional Parameters
-
Chapter 9: Working with Text
- Learn the Essentials of Strings
- Create Single-Line Strings
- Create Multiline Strings
- Meet Python’s String Methods
- Return Information About a String
- Transform and Clean Up a String
- Return Part of a String via Slicing
- Concatenate and Repeat Strings
- Search for One String Inside Another String
- Check and Change String Capitalization
- Meet Python’s Tools for Building Strings
- Build Strings with the Interpolation Operator
- Build Strings with the .format Method
- Build Strings with f-Strings
- Build Strings with Template Strings
- Chapter 10: Handling Errors
-
Chapter 11: Working with Lists and Dictionaries
- Understanding Lists and Their Use
- Create a List
- Meet Python’s List Methods
- Add Items to a List
- Remove Items from a List
- Locate Items and Access Data in a List
- Sort the Items in a List
- Understanding Dictionaries and Their Use
- Create a Dictionary and Return Values
- Meet Python’s Dictionary Methods
- Create a Dictionary from an Existing Iterable
- Add Key/Value Pairs to a Dictionary
- Remove Key/Value Pairs from a Dictionary
- Return Keys and Values from a Dictionary
- Chapter 12: Working with Classes
- Index
- End User License Agreement
Product information
- Title: Teach Yourself VISUALLY Python
- Author(s):
- Release date: September 2022
- Publisher(s): Wiley
- ISBN: 9781119860259
You might also like
book
Learn Python Visually
This beginners book introduces non-programmers to the fundamentals of computer coding within a visual, arts-focused context. …
book
Learn Python Programming - Third Edition
Get up and running with Python 3.9 through concise tutorials and practical projects in this fully …
book
Learning Python, 5th Edition
Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on …
book
Deep Learning with Python, Second Edition
Printed in full color! Unlock the groundbreaking advances of deep learning with this extensively revised new …