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

Python Basics: A Practical Introduction to Python 3

There’s an overwhelming amount of information about Python on the internet…

But for many beginners (who are studying on their own), the lack of structure for what you should learn and in what order is missing.

If you’re wondering:

“What should I learn about Python in the beginning to get a strong foundation?”

Then this book is for you—whether you’re a complete beginner or already dabbled in Python or other languages before.

Written in plain English, Python Basics breaks down the core concepts you really need to know into bite-sized chunks.

You’ll know “enough to be dangerous” with Python, fast:

Instead of just handing you a boring list of language features, you’ll see exactly how the different building blocks fit together and what’s involved in building real apps and scripts with Python.

Step-by-step you’ll master fundamental Python concepts that will help you get started on your journey to learn Python.

With a clear narrative and chapters that build on each other, this book takes you from beginner to intermediate-level in Python 3—the latest and greatest version of the popular programming language.

Python Basics Is for Complete Beginners to Python and Coding: No Prior Programming Experience Necessary

You’ll be introduced to each concept and language feature in a logical order.

Simply follow our practical, step-by-step roadmap and develop your foundational skills. Every step in this complete beginner’s curriculum is explained and illustrated with short & clear code samples.

If you already have some prior coding experience, even better: You’ll be able to move that much quicker and get a crash course that brings you up to speed with modern Python programming.

Coding exercises within each chapter and our interactive quizzes help fast-track your progress and ensure you always know what to focus on next.

Get Real Python’s practical introduction to Python 3 that jumps right into the “meat and potatoes” without sacrificing substance

Become a fluent Pythonista and gain programming knowledge you can apply in the real-world, today:

Python Basics Book

Python Basics:
A Practical Introduction to Python 3

Python Basics Book


Visa Mastercard American Express PayPal Apple Pay

[ Or, get a print copy on Amazon. ]

Gain Effective Real-World Python Skills

The first half of this book is a quick yet thorough overview of all the Python fundamentals. You do not need any prior experience with programming to get started and we’ll teach you everything you need to know, step-by-step.

The second half focuses on solving interesting, real-world problems in a practical manner using Python. Once you have the fundamentals down you’ll improve quickly by following along with our hands-on coding exercises and projects.

We’ve taken great care laying out each page in the book with beautiful typography, syntax highlighting for code examples, and instructional screenshots so you can process and memorize the information effectively:

Python Basics Book Example
Screenshots and Illustrations
Python Basics Book Example
Code Examples and Sidebar Discussions

All of the material is completely up to date for Python 3, the latest and greatest version of the Python programming language released. In a nutshell, here’s what you’ll learn with Python Basics: A Practical Introduction to Python 3:

  • Installing & Running Python: Setting up a Python 3 coding environment on Windows, macOS, or Linux
  • Core Python 3 Concepts & Conventions: Interpreter sessions, scripts, finding and fixing code bugs, how to organize code and structure Python programs, how to learn and practice effectively
  • Python 3 Fundamentals: Variables, primitive data types, functions and loops, conditional logic and control flow, string formatting, lists/tuples/dictionaries, file input and output, error handling
  • Intermediate Python Concepts: Object-oriented programming (OOP), regular expressions, namespaces and scoping, exception handling, installing third-party packages
  • Real-World Practical Usage of Python: Creating and modifying PDF files, working with databases, downloading and scraping content from the web, data-science basics (scientific computing and plotting), graphical user interfaces and GUI programming
  • …Plus Many More “Sidebars” and Technical Deep-Dives to Keep Things Interesting Along the Way

Chapter 1: Introduction How to make the most of this book so you can learn effectively and quickly get up to speed with Python 3.

Chapter 2: Setting Up Python See step-by-step how to install a Python development environment on Windows, macOS, and Linux.

Chapter 3: Your First Python Program Now that you have the latest version of Python installed on your computer, it’s time to start coding. You’ll write your first Python script, learn what happens when you run a script with an error, learn how to declare a variable and inspect its value, and learn how to write comments.

Chapter 4: Strings and Methods Learn how to work with strings in Python. Becoming proficient in manipulating strings is a skill with big payoffs, because a lot of the data encountered in the real world is in the form of unstructured text.

Chapter 5: Numbers in Python How to work with Python’s built-in number types, how to round numbers in Python, and how to format and display numbers.

Chapter 6: Functions and Loops See how to define and use your own custom functions as the core building blocks of your programs. You will also learn another fundamental aspect of programming: how to loop over data. Together, functions and loops are powerful tools to use in your programs, and mastering them will take your progress to the next level.

Chapter 7: Finding and Fixing Code Bugs A debugger is a program you can use to better understand where bugs are located in your code. In this chapter, you’ll learn how to use IDLE’s built-in debugger.

Chapter 8: Conditional Logic and Control Flow Learn the mechanics of writing programs that do different things based on different conditions. The use of conditions in programming is called conditional logic.

Chapter 9: Tuples, Lists, and Dictionaries In this chapter, you will meet three new and important data structures: Lists, Tuples, and Dictionaries. All three of these data types are containers, meaning they are objects that “contain” other objects.

Chapter 10: Object-Oriented Programming (OOP) In this chapter you will learn how to declare your own custom objects in Python and then use those objects to structure your program according to the principles of object-oriented programming (OOP).

Chapter 11: Modules and Packages Python modules are building blocks you can put together to create a larger application. In this chapter you’ll learn how to create your own modules, use modules in another file via the “import” statement, and organize several modules into a package.

Chapter 12: File Input and Output Learn how to work with files in Python. Working with files is an essential skill that is used by Python programmers working in any discipline, including web development, business automation, and data science.

Chapter 13: Installing Packages With Pip In this chapter you will learn the basics of working with the “Pip” package manager and you’ll use it to install your first Python package from the web.

Chapter 14: Creating and Modifying PDF Files In this chapter, you will learn how to read from, write to, and modify PDF files with Python.

Chapter 15: Working With Databases In this chapter, you will learn about a SQL database, called SQLite, that comes with every Python installation. You will learn how to retrieve and store data from SQLite programmatically using the “sqlite” module.

Chapter 16: Interacting With the Web Web scraping is the process of collecting and parsing raw data from the web. See how to extract and process text from web sites and how to automate interactions with web forms.

Chapter 17: Scientific Computing and Graphing In this chapter, you will get an introduction to two of the most powerful Python packages for scientific computing and data science: NumPy and Matplotlib.

Chapter 18: Graphical User Interfaces In this chapter you will focus on learning the basics of creating a GUI with Python, beginning with a simple way to create GUI elements using a package called EasyGUI. After that, you’ll dive into creating more complex GUIs with Tkinter, all the way to building a full-fledged GUI text editor app.

Chapter 19: Final Thoughts and Next Steps A recap of what you learned in the book and what you should be focusing on next.

Bonus Learning Materials

With Python Basics you’ll go from beginner to intermediate Python knowledge with a clear, concise, and practical curriculum.

But we’re not done yet—

To help you study effectively you’ll get additional bonus materials such as exercises, interactive coding quizzes, and more, included with the book.

Take advantage of this valuable bonus content and make the most of your study time:

💡 Interactive Python Quizzes for checking your learning progress. Each quiz takes you through a series of questions related to a particular chapter in the book. Some of them are multiple choice, some will ask you to type an answer, and for some you’ll write actual Python code:

Python Basics Book Quiz
Interactive Quizzes to Check Your Learning Progress

As you make your way through each quiz, it keeps score on which questions you answered correctly. At the end of the quiz you receive a grade based on your result.

The quizzes are a fun way for you to check your learning progress as you make your way through the book. One question at a time, they’ll help you identify and fix weak spots in your Python knowledge.

💡 Review Exercises for the concepts you learn in each section of the book. The coding exercises are short and to-the-point. They come with a full set of solutions and sample code so you can always check and compare your answers to what a professional Pythonista would do.

  1. Create a float object named weight with the value 0.2, and create a string object named animal with the value "newt". Then use these objects to print the following string using only string concatenation:

    0.2 kg is the weight of the newt.
  2. Display the same string by using the .format() method and empty {} place-holders.

  3. Display the same string using an f-string.

# 4.7 - Streamline Your Print Statements
# Solutions to review exercies

# --- Exercise 1
weight = 0.2
animal = "newt"

# Concatenate a number and a string in 
# one print function call:
print(str(weight) + " kg is the weight of the " + animal + ".")

# --- Exercise 2
# Use format() to print a number and 
# a string inside of another string:
print("{} kg is the weight of the {}.".format(weight, animal))

# --- Exercise 3
# Use formatted string literal (f-string)
# to reference objects inside a string:
print(f"{weight} kg is the weight of the {animal}.")

💡 Recommended Resources to further deepen your Python skills. The author team maintains a list of recommended links and additional learning resources. This list gets updated and expanded over time so that you’re always informed about modern and up-to-date best practices.

💡 Sample Projects and Code Challenges showing you how to build fun & rewarding example projects using your newfound Python skills. All challenges and exercises come with full sample (solution) code so you can check your own implementation against them. Here are some of the Python projects you’ll build:

  • Temperature converter tool
  • Stock investment tracker
  • Election simulator
  • Poetry generator
  • High-scores tracker
  • PDF watermark generator
  • GUI-based text editor
  • … and many more

💡 An Online Learning Path that guides you through the chapters, quizzes, and exercises in the book so you’ll always know what to focus on next.

💡 Free Updates for life, because programming is a fast-moving field. As a Python Basics customer you’ll receive free updates to the book and bonus materials.

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.

To recap, let’s take another look at what you’ll receive with this offer—

Here’s What’s “In The Box”

Python Basics Book

627 page book in DRM-free PDF, ePub, and Kindle formats

✅ 17 interactive Python quizzes

✅ Comprehensive review exercises & coding challenges

Solution code + sample projects for all exercises and code challenges

✅ Online learning path for tracking your progress

Bonus learning resources for deepening your skills

Free updates for life

Python Basics Book


Visa Mastercard American Express PayPal Apple Pay

[ Or, get a print copy on Amazon. ]

Meet the Authors

At Real Python you’ll learn real-world programming skills from a community of professional Pythonistas from all around the world. Everyone who worked on this book is a practitioner with several years of professional experience in the software industry. Here are the authors who worked on Python Basics:

David Amos

David Amos

David is the content technical lead for Real Python. After leaving academia in 2015, David worked in various technical positions as a programmer and data scientist. In 2019, David joined Real Python full time to pursue his passion for education. He lead the charge on rewriting and updating the Python Basics curriculum to Python 3.

Dan Bader

Dan Bader

Dan is the owner and editor in chief of Real Python and the main developer of the learning platform. Dan has been writing code for more than twenty years and holds a master‘s degree in computer science. He‘s the author of Python Tricks, a best-selling programming book for intermediate Python developers.

Joanna Jablonski

Joanna Jablonski

Joanna is the executive editor of Real Python. She likes natural languages just as much as she likes programming languages. Her love for puzzles, patterns, and pesky little details led her to follow a career in translation. It was only a matter of time before she would fall in love with a new language: Python! She joined Real Python in 2018 and has been helping Pythonistas level up ever since.

Fletcher Heisler

Fletcher Heisler

Fletcher Heisler is the founder of Hunter2, where he teaches developers how to hack and secure modern web apps. As one of the founding members of Real Python, Fletcher wrote the first version of the Python curriculum this book is based on in 2012.

What Pythonistas Say About the Book

Python Basics is based on the first book in the original Real Python Course released in 2012. For this revised and updated 4th edition we’ve rewritten large parts of the book to expand and update it for Python 3.

The contents have been “battle-tested” by thousands of Pythonistas, data scientists, and developers working for companies big and small, such as Amazon, Red Hat, and Microsoft. Here’s what some of them had to say:

“I love [the book]! The wording is casual, easy to understand, and makes the information flow well. I never feel lost in the material, and it’s not too dense so it’s easy for me to review older chapters over and over.

I’ve looked at over 10 different Python tutorials/books/online courses, and I’ve probably learned the most from Real Python!”

Thomas Wong

“Three years later and I still return to my Real Python books when I need a quick refresher on usage of vital Python commands.”

Rob Fowler

“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

Python Basics Book


Visa Mastercard American Express PayPal Apple Pay

[ Or, get a print copy on Amazon. ]

“I love the book because at the end of each particular lesson there are real world and interesting challenges. I just built a savings estimator that actually reflects my savings account – neat!”

Drew Prescott

“As a practice of what you taught I started building simple scripts for people on my team to help them in their everyday duties. When my managers noticed that, I was offered a new position as a developer.

I know there is heaps of things to learn and there will be huge challenges, but I finally started doing what I really came to like.

Once again: MANY THANKS!”


“What I found great about the Real Python courses compared to others is how they explain things in the simplest way possible.

A lot of courses, in any discipline really, require the learning of a lot of jargon when in fact what is being taught could be taught quickly and succinctly without too much of it. The courses do a very good job of keeping the examples interesting.”

Stephen Grady

“After reading the first Real Python course I wrote a script to automate a mundane task at work. What used to take me three to five hours now takes less than ten minutes!”

Brandon Youngdale

1 Year “Try It Yourself” Guarantee—
Learn Python Or You Pay

The last thing we want is for you to pass on this book because you’re not sure it’ll work for you. We know it will, so here’s our offer to you:

Put us to the test. Take “Python Basics: A Practical Introduction to Python 3” for a spin today.

Spend just a few days with the material and start building your Python skills.

Then take up to a full year to grow them.

And if for some reason you don’t agree that we’ve given you a faster, easier way to absorb the knowledge you need to rise head-and-shoulders above other developers, we will cheerfully refund your money, no questions and no hassles, any time within the next year.

Either way, all the risk is on us.

The Real Python "Your Money Back Guarantee"

Python Basics Book


Visa Mastercard American Express PayPal Apple Pay

[ Or, get a print copy on Amazon. ]


Got any sample chapters? Sure do! Click here to download a PDF sample. Enjoy!

What if I don’t like the book? We want happy customers only. If you’re not happy with the digital version of the book, send us an email and tell us where it left you hanging. We’ll refund you in full—even 12 months later.

Which Python versions does the book cover? What if I can’t use Python 3.9? The book covers Python 3 and we’ve validated all examples using Python 3.6 and above. Most of the book will apply to Python 3.5 and below, the only feature that requires Python 3.6+ is f-strings in the String Formatting chapter. So don’t worry if you can’t use the latest version of Python to go through the book. As long as you have *a* version of Python 3 available to work with you’ll be fine. Additionally, at the start of the book you’ll see how to upgrade your Python install.

Can I order a print version? Yes, Python Basics is available on Amazon as a printed book (paperback). Click here to order a printed copy.

How will I receive updates? We announce updates via email as they come out. Plus, you’ll always find the latest version of the book available for download in your account.

I have another question! Please email us at and we’ll get back to you as soon as possible.

Python Basics Book


Visa Mastercard American Express PayPal Apple Pay

[ Or, get a print copy on Amazon. ]