Best 15+ Machine Learning Cheat Sheets to Pin to Your Toilet Wall

Toilet Wall Cheat Sheet

This article compiles for you the 15 best cheat sheets in the web that help you get started with machine learning. If you’re short on time, here are the 15 direct PDF links (open in a new tab): Each cheat sheet link points directly to the PDF file. So don’t lose any more time, and … Read more

Python Regex Split Without Empty String

Problem Formulation Say, you use the re.split(pattern, string) function to split a string on all occurrences of a given pattern. If the pattern appears at the beginning or the end of the string, the resulting split list will contain empty strings. How to get rid of the empty strings automatically? Here’s an example: Note the … Read more

Python endswith() Tutorial – Can We Use Regular Expressions?

While refactoring my Python code, I thought of the following question. Can You Use a Regular Expression with the Python endswith() Method? The simple answer is no because if you can use a regex, you won’t even need endswith()! Instead, use the re.match(regex, string) function from the re module. For example, re.match(“^.*(coffee|cafe)$”, tweet) checks whether … Read more

Python next()

The next(iterator) function is one of Python’s built-in functions—so, you can use it without importing any library. It returns the next value from the iterator you pass as a required first argument. An optional second argument default returns the passed default value in case the iterator doesn’t provide a next value. Syntax: next(iterator, <default>) Arguments: … Read more

Python IDLE Syntax Highlighting

Python’s IDLE code editor comes with every standard Python installation in Windows, Linux, and macOS. You can use it right out of the box after installing Python on your computer. Related Article: How to Install Python? IDLE has a useful syntax highlighting feature that highlights different Python language features to help you grasp source code … Read more

Python iter() — A Simple Illustrated Guide with Video

Python’s built-in iter() function returns an iterator for the given object. For example, iter([1, 2, 3]) creates an iterator for the list [1, 2, 3]. You can then iterate over all elements in the iterator, one element at a time, in a for or while loop such as: for x in iter([1, 2, 3]). Basic … Read more

What’s the Double Colon :: Operator in Python?

Problem Formulation: What does the double colon string[::2] or sequence[3::4] mean in Python? >>> string[::2] You can observe a similar double colon :: for sequences: >>> lst = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> lst[::2] Answer: The double colon is a special case in Python’s extended slicing feature. The extended slicing … Read more