Skip to content

Python

How to Add Items to a Python Dictionary Cover Image

Python: Add Key:Value Pair to Dictionary

In this tutorial, you’ll learn how to add key:value pairs to Python dictionaries. You’ll learn how to do this by adding completely new items to a dictionary, adding values to existing keys, and dictionary items in a for loop, and

Introduction to Python Programming (Beginner's Guide) Cover Image

Introduction to Python Programming (Beginner’s Guide)

In this series, you’ll learn the key Python concepts you need to know to get started with using Python for data science. The course will take you from a complete beginner all the way through taking on your own machine

How to Select Random Items from a List in Python Cover Image

Python: Select Random Element from a List

Learn how to use Python to choose a random list element, with and without replacement and how to replicate results with a random seed.

Python Check if File Directory Exists Cover Image

Python: Check if a File or Directory Exists

Learn how to use Python to check if a file or a directory exists, using the pathlib and os libraries, including writing conditional checks.

How to Remove Items from a Python Set Cover Image

How to Remove Items from Python Sets

In this tutorial, you’ll learn how to remove items from a Python set. You’ll learn how to remove items using the remove method, the discard method, the pop method, and the difference_update method. You’ll learn the differences between each of

Python Sort String with Sorted Cover image

Python: Sort a String (4 Different Ways)

Learn how to use Python to sort a string including how to sort strings using the sorted function, with case sensitivity or insensitivity.