Python zip() function examples

March 26, 2022 A Goodman

This article is about the zip() function in Python 3. We’ll cover the fundamentals then walk through a few practical examples. Overview zip() is a built-in function of Python that works like a zipper. It can…

Python reduce() function examples

March 26, 2022 A Goodman

In this article, you will learn about the syntax and walk through 3 examples of using the reduce() function in Python. Overview To use the reduce() function, you need to import it from the functools module…

Python filter() function examples

March 26, 2022 A Goodman

In this article, we will cover the fundamental of the filter() function in Python and explore 4 practical examples of using it. Overview Syntax: Parameters: function: The function that tests whether each item of an iterable…

Examples of using map() function in Python 3

March 26, 2022 A Goodman

In this article, we’ll go over a few examples of using the map() function in Python 3. Overview Syntax: function: The function to execute for each item iterables: one or many iterables (lists, tuples, etc). The…

Examples of using Lambda Functions in Python 3

March 26, 2022 The Plumber

A lambda function in Python is a small anonymous function that is defined by using the lambda keyword, like this: A lambda function can take unlimited number of arguments but it is syntactically restricted to a…

VS Code: How to comment out a block of Python code

March 26, 2022 The Plumber

To comment out a line of code in Python, you can add a # before that line. So how to comment out a block of code in Python? If you have worked with some other programming…

Examples of numpy.linspace() in Python

February 23, 2022 The Plumber

The numpy.linspace() function returns a ndarray with equally spaced intervals between the start and stop values. That ndarray is a vector space, also known as a linear space. That’s why the function is named linspace. This…

Extract all links from a webpage using Python and Beautiful Soup 4

March 26, 2022 The Shadow

This article shows you how to get all links from a webpage using Python 3, the Requests module, and the Beautiful Soup 4 module. For the demonstration purpose, I will scrape and extract the main page…

Most popular String methods in Python

March 26, 2022 The Plumber

Python provides a lot of methods that help programmers easily and quickly modify and manipulate strings. Learning all of these methods by heart is a hard job that takes much time and effort, and you may…

Python Malloc Error: Can’t Allocate Region

January 26, 2022 A Goodman

This short article is about a common error that you may encounter when working with Python on macOS. Problem When running Python code that imports some modules (request, numpy, pandas, etc), I fall into the following…

Python program to count lower case letters in a string

February 23, 2022 Guest Contributor

To check if a letter is lower case or not in Python, we can use the islower() method. Combine it with a for loop, we can easily count the number of lower case letters in a…

Python program to count all capital letters in a string

February 23, 2022 Guest Contributor

The following Python program counts the number of capital letters in a string. The code: Output: That’s it. Happy coding with Python. Extract all links from a webpage using Python and Beautiful Soup 4 List, Dict,…

1 2 3 4