Python tutorials

Mazes in Python Part 1: Building and Visualizing

If you’re up for a little challenge and would like to take your programming skills to the next level, then you’ve come to the right place! In this hands-on video course, you’ll practice object-oriented programming, among several other good practices, while building a cool maze solver project in Python. This is the first part in a two-part series. Throughout the series, you’ll go step by step through the guided process of building a complete and working project. This will include […]

Read more

Using the NumPy Random Number Generator

Once you have a NumPy array, regardless of whether you’ve generated it randomly or obtained it from a more ordered source, there may be times when you need to select elements from it randomly or reorder its structure randomly. You’ll learn how to do this next. Selecting Array Elements Randomly Suppose you have a NumPy array of data collected from a survey, and you wish to use a random sample of its elements for analysis. The Generator object’s .choice() method […]

Read more

Create and Modify PDF Files in Python

So far, you’ve learned how to extract text and pages from PDFs and how to concatenate and merge two or more PDF files. These are all common operations with PDF files, but pypdf has many other useful features. In the following sections, you’ll learn how to rotate and crop pages in a PDF file. Rotating Pages With PageObject.rotate() You’ll start by learning how to rotate pages. For this example, you’ll use the ugly.pdf file in the practice_files/ folder. This file […]

Read more

Getting the First Match From a Python List or Iterable

At some point in your Python journey, you may need to find the first item that matches a certain criterion in a Python iterable, such as a list or dictionary. The simplest case is that you need to confirm that a particular item exists in the iterable. For example, you want to find a name in a list of names or a substring inside a string. In these cases, you’re best off using the in operator. However, there are many […]

Read more

Choosing the Best Coding Font for Programming

When you’re coding, there’s always a font involved in displaying the text on the screen. Yet, the font that you use is an often-overlooked piece in your programming tool kit. Many operating systems and code editors come with their default monospace fonts that you may end up using. But there are a bunch of technicalities and features to take into consideration when choosing the best font for your daily programming. That’s why it’s worth investigating the requirements that a programming […]

Read more
1 44 45 46 47 48 191