Python Basics Exercises: Numbers and Math

In Python Basics: Numbers and Math, you learned the mathematical skills that you’ll need as a Python programmer. Now, you’ll take those skills to the next level by actively practicing and applying what you’ve learned. In this hands-on course, you’ll have the opportunity to reinforce your understanding of numbers and math in Python programming through a series of exercises and coding challenges. By actively engaging with the material, you’ll gain the confidence you need to apply your learning in real-world […]

Read more

Python News: What’s New From October 2023

October 2023 saw the release of the new Python 3.12. At the same time, focus has shifted to new developments in the language. The acceptance of the long-discussed PEP 703 means that developers can ramp up their work on a free-threading version of Python. The steering council does an important job governing Python and its development. Nominations for the next steering council are now open. Currently, groups are being established that’ll support the steering council by specifically focusing on typing […]

Read more

Build a Hangman Game for the Command Line in Python

Many people learn basic language and word skills by playing the game of hangman. First mentioned in print in the late nineteenth century and popularized in international media as the game show Wheel of Fortune, hangman appeals to many people. For beginning programmers who want a challenge or for more experienced coders looking for a bit of fun, writing hangman in Python is a rewarding endeavor. Throughout this tutorial, you’ll build the hangman game in Python in a series of […]

Read more

Using the bpython Enhanced REPL

The standard Python interpreter lets you run scripts from files or interactively execute code on the fly in a so-called read-evaluate-print loop (REPL). While this is a powerful tool for exploring the language and discovering its libraries through instant feedback on your code inputs, the default REPL shipped with Python has several limitations. Luckily, alternatives like bpython offer a much more programmer-friendly and convenient experience. You can use bpython to experiment with your code or quickly test an idea without […]

Read more

How to Use Type Hints for Multiple Return Types in Python

In Python, type hinting is an optional yet useful feature to make your code easier to read, reason about, and debug. With type hints, you let other developers know the expected data types for variables, function arguments, and return values. As you write code for applications that require greater flexibility, you may need to specify multiple return types to make your code more robust and adaptable to different situations. You’ll encounter different use cases where you may want to annotate […]

Read more

Boost Your Coding Productivity With Ptpython

Ptpython is a feature-rich and user-friendly Python REPL (Read-Eval-Print Loop) that takes your interactive Python coding experience to a whole new level. Unlike the standard Python REPL, ptpython offers a host of powerful features designed to boost productivity and streamline the development process. Its intuitive interface, syntax highlighting, and robust auto-completion capabilities make writing and exploring Python code a breeze. The interactive shell also provides the built-in ability to inspect Python objects, so you can quickly look up function references […]

Read more

Python Basics Exercises: Building Systems With Classes

In Python Basics: Building Systems With Classes, you moved beyond the basics of object-oriented programming (OOP), and started to put those classes to work. In this exercise course you will employ these capabilities to build more complex systems and write readable, reusable code. In this video course, you’ll practice the following: Compose classes together to create layers of functionality Inherit and override behavior from other classes to create variations Creatively mix and match these approaches Instantiate classes with attributes and […]

Read more

How to Run Your Python Scripts and Code

Watch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Running Python Scripts A Python script or program is a file containing executable Python code. Being able to run Python scripts and code is probably the most important skill that you need as a Python developer. By running your code, you’ll know if it works as planned. You’ll also be able to test and […]

Read more

Speeding up Cython with SIMD

Cython allows you to write compiled extensions for Python, by translating Python-y code to C or C++. Often you’ll use it to speed up your software, and it’s especially useful for implementing small data science or scientific computing algorithms. But what happens when Cython is too slow? Often there’s still speed improvements you can do. In a previous article we focused on examples of optimizing your code to take advantage of things like instruction-level parallelism. In this article, we’ll focus […]

Read more

When should you upgrade to Python 3.12?

Python 3.12 is out now–but should you switch to it immediately? And if you shouldn’t upgrade just yet, when should you? Immediately after the release, you may not want to upgrade just yet. But from December 2023 and onwards, upgrading is definitely worth trying. To understand why, we need to consider Python packaging, the software development process, and take a look at the history of past releases. The problems with a new major Python release As with many open source […]

Read more
1 80 81 82 83 84 908