Python tutorials

How Can You Install a Pre-Release Version of Python?

The Python language is in constant development. A new version is released annually in October to great fanfare. Before these stable releases, you can preview the new features by installing a pre-release of Python. Volunteers worldwide work on developing Python by updating the documentation, reporting issues, suggesting and discussing improvements, fixing bugs, and implementing new features. You can join this work and contribute to the efforts. The best way to start getting involved in the development of Python is to […]

Read more

Python Basics: Functions and Loops

Functions are the building blocks of almost every Python program. They’re where the real action takes place! In your Python Basics journey, you’ve probably encountered functions such as print(), len(), and round(). These are all built-in functions because they come built into the Python language itself. You can also create user-defined functions that perform specific tasks. Functions break code into smaller chunks and are great for defining actions that a program will execute several times throughout your code. Instead of […]

Read more

Python and PyQt: Building a GUI Desktop Calculator

Even though web and mobile applications appear to have taken over the software development market, there’s still demand for traditional graphical user interface (GUI) desktop applications. If you’re interested in building these kinds of applications in Python, then you’ll find a wide variety of libraries to choose from. They include Tkinter, wxPython, PyQt, PySide, and a few others. In this tutorial, you’ll learn the basics of building GUI desktop applications with Python and PyQt. For this tutorial, you’ll create a […]

Read more

Building a URL Shortener With FastAPI and Python

In this video course, you’ll build a URL shortener with Python and FastAPI. URLs can be extremely long and not user-friendly. This is where a URL shortener can come in handy. A URL shortener reduces the number of characters in a URL, making it easier to read, remember, and share. By following this step-by-step project, you’ll build a URL shortener with Python and FastAPI. At the end of this course, you’ll have a fully functional API-driven web app that creates […]

Read more

Python’s exec(): Execute Dynamically Generated Code

Python’s built-in exec() function allows you to execute arbitrary Python code from a string or compiled code input. The exec() function can be handy when you need to run dynamically generated Python code, but it can be pretty dangerous if you use it carelessly. In this tutorial, you’ll learn not only how to use exec(), but just as importantly, when it’s okay to use this function in your code. In this tutorial, you’ll learn how to: Work with Python’s built-in […]

Read more

How to Check if a Python String Contains a Substring

If you’re new to programming or come from a programming language other than Python, you may be looking for the best way to check whether a string contains another string in Python. Identifying such substrings comes in handy when you’re working with text content from a file or after you’ve received user input. You may want to perform different actions in your program depending on whether a substring is present or not. In this tutorial, you’ll focus on the most […]

Read more

Invasive procedures: Python affordances for performance measurement

When your Python code is too slow, you need to identify the bottleneck that’s causing it: you need to understand what your code is doing. Luckily, beyond pre-existing profiling tools, there are also a variety of ways you can poke and prod Python programs to get a better understanding of what they’re doing internally. This allows you to do one-time introspection, add profiling facilities to your program that you can turn on and off, build custom tools, and in general […]

Read more

How to Find an Absolute Value in Python

Absolute values are commonly used in mathematics, physics, and engineering. Although the school definition of an absolute value might seem straightforward, you can actually look at the concept from many different angles. If you intend to work with absolute values in Python, then you’ve come to the right place. In this tutorial, you’ll learn how to: Implement the absolute value function from scratch Use the built-in abs() function in Python Calculate the absolute values of numbers Call abs() on NumPy […]

Read more

Caching in Python With lru_cache

There are many ways to achieve fast and responsive applications. Caching is one approach that, when used correctly, makes things much faster while decreasing the load on computing resources. Python’s functools module comes with the @lru_cache decorator, which gives you the ability to cache the result of your functions using the Least Recently Used (LRU) strategy. This is a simple yet powerful technique that you can use to leverage the power of caching in your code. In this video course, […]

Read more

GitHub Copilot: Fly With Python at the Speed of Thought

GitHub Copilot is a thrilling new technology that promises to deliver to your code editor a virtual assistant powered by artificial intelligence, and it stirred up considerable controversy when it was released to the general public. Python is among the languages that are particularly well-supported by this tool. After reading this tutorial, you’ll know whether GitHub Copilot is a risk, a gimmick, or a true game changer in software engineering. To continue with this tutorial, you need to have a […]

Read more
1 86 87 88 89 90 181