Python tutorials

Python’s Self Type: How to Annotate Methods That Return self

Have you ever found yourself lost in a big repository of Python code, struggling to keep track of the intended types of variables? Without the proper use of type hints and annotations, uncovering variable types can become a tedious and time-consuming task. Perhaps you’re an avid user of type hints but aren’t sure how to annotate methods that return self or other instances of the class itself. That’s the issue that you’ll tackle in this tutorial. First, though, you’ll need […]

Read more

Recursion in Python

If you’re familiar with functions in Python, then you know that it’s quite common for one function to call another. In Python, it’s also possible for a function to call itself! A function that calls itself is said to be recursive, and the technique of employing a recursive function is called recursion. It may seem peculiar for a function to call itself, but many types of programming problems are best expressed recursively. When you bump up against such a problem, […]

Read more

Python’s raise: Effectively Raising Exceptions in Your Code

In your Python journey, you’ll come across situations where you need to signal that something is going wrong in your code. For example, maybe a file doesn’t exist, a network or database connection fails, or your code gets invalid input. A common approach to tackle these issues is to raise an exception, notifying the user that an error has occurred. That’s what Python’s raise statement is for. Learning about the raise statement allows you to effectively handle errors and exceptional […]

Read more

How to Make Engaging Programming Videos

Programming videos have become an increasingly popular medium for sharing knowledge and helping the fellow developers on your team. Especially when you’re working remotely, effective communication is vital, and screencasts have emerged as a powerful tool that meets this need. That’s why knowing how to make programming videos is a valuable skill, no matter where you are in your career. Even if you’ve never considered creating video content yourself, creating a screencast can be a great way to enhance written […]

Read more

Python Basics: Reading and Writing Files

Files are everywhere in the modern world. They’re the medium in which data is digitally stored and transferred. Chances are, you’ve opened dozens, if not hundreds, of files just today! Now it’s time to read and write files with Python. In this video course, you’ll learn how to: Understand the difference between text and binary files Learn about character encodings and line endings Work with file objects in Python Read and write character data in various file modes Use open(), […]

Read more
1 36 37 38 39 40 185