Skip to content

Python

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.

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.