My goal here is for something that is partly a tutorial and partly a reference book. I like how tutorials get you up and running quickly, but they can often be a little wordy and disorganized. Reference books contain a lot of good information, but they are often too terse, and they don’t often give
Python Basics: A Practical Introduction to Python 3
✍ Scribed by David Amos, Dan Bader, Joanna Jablonski, Fletcher Heisler
- Publisher
- Real Python (realpython.com)
- Year
- 2021
- Tongue
- English
- Leaves
- 643
- Category
- Library
No coin nor oath required. For personal study only.
✦ Synopsis
Make the Leap From Beginner to Intermediate in Python…
Python Basics: A Practical Introduction to Python 3
Your Complete Python Curriculum—With Exercises, Interactive Quizzes, and Sample Projects
What should you learn about Python in the beginning to get a strong foundation? With Python Basics, you’ll not only cover the core concepts you really need to know, but you’ll also learn them in the most efficient order with the help of practical exercises and interactive quizzes. You’ll know enough to be dangerous with Python, fast!
Who Should Read This Book
- If you’re new to Python, you’ll get a practical, step-by-step roadmap on developing your foundational skills. You’ll be introduced to each concept and language feature in a logical order. Every step in this curriculum is explained and illustrated with short, clear code samples. Our goal with this book is to educate, not to impress or intimidate.
- If you’re familiar with some basic programming concepts, you’ll get a clear and well-tested introduction to Python. This is a practical introduction to Python that jumps right into the meat and potatoes without sacrificing substance. If you have prior experience with languages like VBA, PowerShell, R, Perl, C, C++, C#, Java, or Swift the numerous exercises within each chapter will fast-track your progress.
- If you’re a seasoned developer, you’ll get a Python 3 crash course that brings you up to speed with modern Python programming. Mix and match the chapters that interest you the most and use the interactive quizzes and review exercises to check your learning progress as you go along.
- If you’re a self-starter completely new to coding, you’ll get practical and motivating examples. You’ll begin by installing Python and setting up a coding environment on your computer from scratch, and then continue from there. We’ll get you coding right away so that you become competent and knowledgeable enough to solve real-world problems, fast. Develop a passion for programming by solving interesting problems with Python every day!
- If you’re looking to break into a coding or data-science career, you’ll pick up the practical foundations with this book. We won’t just dump a boat load of theoretical information on you so you can “sink or swim”—instead you’ll learn from hands-on, practical examples one step at a time. Each concept is broken down for you so you’ll always know what you can do with it in practical terms.
- If you’re interested in teaching others “how to Python,” this will be your guidebook. If you’re looking to stoke the coding flame in your coworkers, kids, or relatives—use our material to teach them. All the sequencing has been done for you so you’ll always know what to cover next and how to explain it.
What Python Developers Say About The Book:
“Go forth and learn this amazing language using this great book.” — Michael Kennedy, Talk Python
“The wording is casual, easy to understand, and makes the information flow well.” — Thomas Wong, Pythonista
“I floundered for a long time trying to teach myself. I slogged through dozens of incomplete online tutorials. I snoozed through hours of boring screencasts. I gave up on countless crufty books from big-time publishers. And then I found Real Python. The easy-to-follow, step-by-step instructions break the big concepts down into bite-sized chunks written in plain English. The authors never forget their audience and are consistently thorough and detailed in their explanations. I’m up and running now, but I constantly refer to the material for guidance.” — Jared Nielsen, Pythonista
✦ Table of Contents
Contents
Foreword
Introduction
Why This Book?
About Real Python
How to Use This Book
Bonus Material & Learning Resources
Setting Up Python
A Note On Python Versions
Windows
macOS
Ubuntu Linux
Your First Python Program
Write a Python Script
Mess Things Up
Create a Variable
Inspect Values in the Interactive Window
Leave Yourself Helpful Notes
Summary and Additional Resources
Strings and String Methods
What is a String?
Concatenation, Indexing, and Slicing
Manipulate Strings With Methods
Interact With User Input
Challenge: Pick Apart Your User's Input
Working With Strings and Numbers
Streamline Your Print Statements
Find a String in a String
Challenge: Turn Your User Into a L33t H4x0r
Summary and Additional Resources
Numbers and Math
Integers and Floating-Point Numbers
Arithmetic Operators and Expressions
Challenge: Perform Calculations on User Input
Make Python Lie to You
Math Functions and Number Methods
Print Numbers in Style
Complex Numbers
Summary and Additional Resources
Functions and Loops
What is a Function, Really?
Write Your Own Functions
Challenge: Convert Temperatures
Run in Circles
Challenge: Track Your Investments
Understand Scope in Python
Summary and Additional Resources
Finding and Fixing Code Bugs
Use the Debug Control Window
Squash Some Bugs
Summary and Additional Resources
Conditional Logic and Control Flow
Compare Values
Add Some Logic
Control the Flow of Your Program
Challenge: Find the Factors of a Number
Break Out of the Pattern
Recover From Errors
Simulate Events and Calculate Probabilities
Challenge: Simulate a Coin Toss Experiment
Challenge: Simulate an Election
Summary and Additional Resources
Tuples, Lists, and Dictionaries
Tuples Are Immutable Sequences
Lists Are Mutable Sequences
Nesting, Copying, and Sorting Tuples and Lists
Challenge: List of lists
Challenge: Wax Poetic
Store Relationships in Dictionaries
Challenge: Capital City Loop
How to Pick a Data Structure
Challenge: Cats With Hats
Summary and Additional Resources
Object-Oriented Programming (OOP)
Define a Class
Instantiate an Object
Inherit From Other Classes
Challenge: Model a Farm
Summary and Additional Resources
Modules and Packages
Working With Modules
Working With Packages
Summary and Additional Resources
File Input and Output
Files and the File System
Working With File Paths in Python
Common File System Operations
Challenge: Move All Image Files To a New Directory
Reading and Writing Files
Read and Write CSV Data
Challenge: Create a High Scores List
Summary and Additional Resources
Installing Packages With Pip
Installing Third-Party Packages With Pip
The Pitfalls of Third-Party Packages
Summary and Additional Resources
Creating and Modifying PDF Files
Extract Text From a PDF
Extract Pages From a PDF
Challenge: PdfFileSplitter Class
Concatenating and Merging PDFs
Rotating and Cropping PDF Pages
Encrypting and Decrypting PDFs
Challenge: Unscramble A PDF
Create a PDF File From Scratch
Summary and Additional Resources
Working With Databases
An Introduction to SQLite
Libraries for Working With Other SQL Databases
Summary and Additional Resources
Interacting With the Web
Scrape and Parse Text From Websites
Use an HTML Parser to Scrape Websites
Interact With HTML Forms
Interact With Websites in Real-Time
Summary and Additional Resources
Scientific Computing and Graphing
Use NumPy for Matrix Manipulation
Use matplotlib for Plotting Graphs
Summary and Additional Resources
Graphical User Interfaces
Add GUI Elements With EasyGUI
Example App: PDF Page Rotator
Challenge: PDF Page Extraction Application
Introduction to Tkinter
Working With Widgets
Controlling Layout With Geometry Managers
Making Your Applications Interactive
Example App: Temperature Converter
Example App: Text Editor
Challenge: Return of the Poet
Summary and Additional Resources
Final Thoughts and Next Steps
Free Weekly Tips for Python Developers
Python Tricks: The Book
Real Python Video Course Library
PythonistaCafe: A Community for Python Developers
Acknowledgements
📜 SIMILAR VOLUMES
You already know you want to learn Python, and a smarter way to learn Python 3 is to learn by doing. The Python Workshop focuses on building up your practical skills so that you can work towards building up your machine learning skills as a data scientist, write scripts that help automate your life
Introduction to Python String Mastery: From Basics to Brilliance If you're holding this book, you're about to embark on a hands-on adventure into the world of Python programming, specifically focusing on string manipulation. "Python String Mastery: From Basics to Brilliance" is designed for th
Get your guided tour through the Python 3.9 interpreter: Unlock the inner workings of the Python language, compile the Python interpreter from source code, and participate in the development of CPython. Are there certain parts of Python that just seem like magic? This book explains the concepts,
<p><span>Get your guided tour through the Python 3.9 interpreter:</span><span> Unlock the inner workings of the Python language, compile the Python interpreter from source code, and participate in the development of CPython.</span></p><p><span>Are there certain parts of Python that just seem like ma
My goal here is for something that is partly a tutorial and partly a reference book. I like how tutorials get you up and running quickly, but they can often be a little wordy and disorganized. Reference books contain a lot of good information, but they are often too terse, and they don’t often give