Python tutorials

Using the “not” Boolean Operator in Python

Python’s not operator allows you to invert the truth value of Boolean expressions and objects. You can use this operator in Boolean contexts, such as if statements and while loops. It also works in non-Boolean contexts, which allows you to invert the truth value of your variables. Using the not operator effectively will help you write accurate negative Boolean expressions to control the flow of execution in your programs. In this tutorial, you’ll learn: How Python’s not operator works How […]

Read more

Django Templates: Built-in Tags and Filters

Django is a powerful framework for creating web applications in Python. Its features include database models, routing URLs, authentication, user management, administrative tools, and a template language. You can compose reusable HTML that changes based on the data you pass to the template language. Django templates use tags and filters to define a mini-language that’s similar to Python—but isn’t Python. You’ll get to know Django templates through the tags and filters you use to compose reusable HTML. In this tutorial, […]

Read more

The NLP Cypher | 10.17.21

David is killing it! Welcome back NLP peeps! Do you miss the old days? The old internet days of modem calling, static websites, you know… a time of innocence where developers were innovating the backbone of the internet at hyper speeds? Well, we are very much going thru that right now via the Web 3.0 revolution. Cryptocurrencies usually get all of the attention but there is something else at play and it involves the entire web. You see, the current […]

Read more

Using the len() Function in Python

In many situations, you’ll need to find the number of items stored in a data structure. Python’s built-in function len() is the tool that will help you with this task. There are some cases in which the use of len() is straightforward. However, there are other times when you’ll need to understand how this function works in more detail and how to apply it to different data types. In this tutorial, you’ll learn how to: Find the length of built-in […]

Read more

Python Assignment Expressions and Using the Walrus Operator

Each new version of Python adds new features to the language. For Python 3.8, the biggest change is the addition of assignment expressions. Specifically, the := operator gives you a new syntax for assigning variables in the middle of expressions. This operator is colloquially known as the walrus operator. This course is an in-depth introduction to the walrus operator. You’ll learn some of the motivations for the syntax update and explore some examples where assignment expressions can be useful. In […]

Read more

A Roadmap to XML Parsers in Python

If you’ve ever tried to parse an XML document in Python before, then you know how surprisingly difficult such a task can be. On the one hand, the Zen of Python promises only one obvious way to achieve your goal. At the same time, the standard library follows the batteries included motto by letting you choose from not one but several XML parsers. Luckily, the Python community solved this surplus problem by creating even more XML parsing libraries. Jokes aside, […]

Read more

Pip vs Conda: an in-depth comparison of Python’s two packaging systems

If you’re using Python in the world of data science or scientific computing, you will soon discover that Python has two different packaging systems: pip and Conda. Which raises some questions: How are they different? What are the tradeoffs between the two? Which should you use? While it’s not possible to answer this question for every situation, in this article you will learn the basic differences, constrained to: Python only; Conda has support for other languages but I won’t go […]

Read more

Python’s property(): Add Managed Attributes to Your Classes

With Python’s property(), you can create managed attributes in your classes. You can use managed attributes, also known as properties, when you need to modify their internal implementation without changing the public API of the class. Providing stable APIs can help you avoid breaking your users’ code when they rely on your classes and objects. Properties are arguably the most popular way to create managed attributes quickly and in the purest Pythonic style. In this tutorial, you’ll learn how to: […]

Read more

Using Pygame to Build an Asteroids Game in Python

Do you want to create your own computer games but like Python too much to abandon it for a career as a game developer? There’s a solution for that! With the Pygame module, you can use your amazing Python skills to create games, from the basic to the very complex. Below, you’ll learn how to use Pygame by making a clone of the Asteroids game! In this course, you’ll learn how to build a complete game, including: Loading images and […]

Read more

Representing Rational Numbers With Python Fractions

The fractions module in Python is arguably one of the most underused elements of the standard library. Even though it may not be well-known, it’s a useful tool to have under your belt because it can help address the shortcomings of floating-point arithmetic in binary. That’s essential if you plan to work with financial data or if you require infinite precision for your calculations. Towards the end of this tutorial, you’ll see a few hands-on examples where fractions are the […]

Read more
1 102 103 104 105 106 181