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.7—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 will help fast-track your progress and ensure you always know what to focus on next.

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

Python Basics:
A Practical Introduction to Python 3

Early Access Discount: We’re currently offering a limited-time only “Early Access” discount for the book while we’re putting the finishing touches on.

You’ll receive the current version of the book (which is 95% complete) and all future updates, including the final version due to be released in 2019.

See the FAQ section at the end of this page for more details.

Python Basics (Early Access Offer)

Add To Cart »
VISA Discover American Express Maestro PayPal

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.7, the latest and greatest version of the Python programming language released in late 2018. 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.7 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.7 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: Lists, Tuples, 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: 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 12: 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 13: Creating and Modifying PDF Files In this chapter, you will learn how to read from, write to, and modify PDF files with Python.

Chapter 14: 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 15: 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 16: 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 17: 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 18: 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”

482 page book in DRM-free PDF format

✅ 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 (Early Access Offer)

Add To Cart »
VISA Discover American Express Maestro PayPal

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:

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 designed the original version of this Python curriculum in 2012.

David Amos

David Amos

David is a mathematician by training, a data scientist-slash-Python developer by profession, and a coffee junkie by choice. He has BSc in Applied Math from University of Houston-Downtown and is a member of the Real Python tutorial team.

Dan Bader

Dan Bader

Dan is the editor-in-chief at Real Python and a complete Python nut. When he's not busy coding or sipping coffee he helps Python developers with tutorials, books, and online training. Dan has a BSc and MSc in computer science and maintains several Python open-source projects.