Python tutorials

Modulo String Formatting in Python

If you’re writing modern Python code with Python 3, you’ll probably want to format your strings with Python f-strings. However, if you’re working with older Python codebases, you’re likely to encounter the string modulo operator for string formatting. If you’re reading or writing Python 2 code, it’ll help if you’re familiar with this technique. Because the syntax still works in Python 3, you might even see developers use it in modern Python codebases. In this tutorial, you’ll learn how to: […]

Read more

How vectorization speeds up your Python code

Python is not the fastest programming language. So when you need to process a large amount of homogeneous data quickly, you’re told to rely on “vectorization.” This leads to more questions: What does “vectorization” actually mean? When does it apply? How does vectorization actually make code faster? To answer that question, we’ll consider interesting performance metrics, learn some useful facts about how CPUs work, and discover that NumPy developers are working hard to make your code faster. What “vectorization” means, […]

Read more

Build a Dice-Rolling Application With Python

Building small projects, like a text-based user interface (TUI) dice-rolling application, will help you level up your Python programming skills. You’ll learn how to gather and validate the user’s input, import code from modules and packages, write functions, use for loops and conditionals, and neatly display output by using strings and the print() function. In this project, you’ll code an application that simulates dice-rolling events. To do so, you’ll use Python’s random module. In this tutorial, you’ll learn how to: […]

Read more

Starting With Python IDLE

If you’ve recently downloaded Python onto your computer, then you may have noticed a new program on your machine called IDLE. You might be wondering, “What is this program doing on my computer? I didn’t download that!” While you may not have downloaded this program on your own, IDLE comes bundled with every Python installation. It’s there to help you get started with the language right out of the box. In this course, you’ll learn how to work in Python […]

Read more

Python News: What’s New From December 2021?

In December 2021, the fourth Python steering council was elected, as usual with a mix of new and returning members. Python’s release-cycle circle of life kept spinning, with new iterations of both Python 3.10 and the upcoming Python 3.11 released. At the same time, the popular Python 3.6 reached end-of-life and will no longer be supported. Amid this flurry of activity, developers from all over had some fun over the holidays by solving the annual Advent of Code puzzles. Let’s […]

Read more

Memory location matters for performance

If you’re writing high-performance code, what matters is how many CPU instructions you run. Right? That’s what I learned long ago in school, anyway, when I took algorithms and data structures classes. The basic assumption was that reading or writing to memory took a small, constant amount of time, and so you could focus on how many operations were being done. This was so fundamental to how we were taught that we didn’t even have to write real code: pseudo-code […]

Read more

Build and Submit HTML Forms With Django – Part 4

In this four-part tutorial series, you’re building a social network with Django that you can showcase in your portfolio. This project is strengthening your understanding of relationships between Django models and showing you how to use forms so that users can interact with your app and with each other. You’re also making your site look good by using the Bulma CSS framework. In the previous part of this series, you added functionality so that users can create dweets on the […]

Read more

Working With Pipenv

Managing multiple Python projects with their own third-party packages can get complicated. It is best practice to use a virtual environment to sandbox the requirements for each of your projects. Enter pipenv, the official recommended package management tool for Python. It handles both installation and virtual environments to help you manage your Python dependencies. In this course, you’ll learn about: How to use pip to install a package Where Python puts packages by default How to use pipenv to create […]

Read more

Build and Handle POST Requests in Django – Part 3

In this four-part tutorial series, you’re building a social network with Django that you can showcase in your portfolio. This project is strengthening and demonstrating your understanding of relationships between Django models and showing you how to use forms so that users can interact with your app and with each other. You’re also making your site look good by using the CSS framework Bulma. In the previous part of this tutorial series, you built templates and views for displaying a […]

Read more

Build a Django Front End With Bulma – Part 2

In this four-part tutorial series, you’re building a social network with Django that you can showcase in your portfolio. This project will strengthen your understanding of relationships between Django models and show you how to use forms so that users can interact with your app and with each other. You’ll also make your Django front end look good by using the Bulma CSS framework. In the first part, you extended the Django User model to add profile information that allows […]

Read more
1 101 102 103 104 105 185