Python List

They Use These 15+ Python Interview Questions To Fail You … (And What You Can Do About It)

Fear Your Coding Interview? This article shows you how to make your coding interview a success. General Tips to Prepare Your Interview Watch Google Interview tips. Read Prof. Philip Guo’s tips. Practice coding in Google Docs. Don’t use a code highlighting editor for your training time. Solve at least 50+ code puzzles. And most importantly: …

They Use These 15+ Python Interview Questions To Fail You … (And What You Can Do About It) Read More »

Python min() — A Simple Illustrated Guide

The min() function returns the minimum of the provided arguments. As arguments, you can either pass a number of comma-separated values, or a single iterable. An optional key function argument allows you to customize the calculation of the minimum by explicitly defining the weight of each value in the iterable that is used as a …

Python min() — A Simple Illustrated Guide Read More »

How To Check If a List Is Nested In Python?

Summary: One of the following methods can be used to check if a list is empty :- Method 1: Using isinstance() With any() Method 2: Using isinstance() And len() Methods Within For Loop Problem: Given a list; how to check if it is nested or not? Considering that you have a list such that it is nested at …

How To Check If a List Is Nested In Python? Read More »

Python max() — A Simple Illustrated Guide

The max() function returns the maximum of the provided arguments. You can pass either an arbitrary number of values, comma-separated, or an iterable as arguments. An optional key function argument allows you to customize the calculation of the maximum by explicitly defining the weight of each value in the iterable that is used as a …

Python max() — A Simple Illustrated Guide Read More »

Python tuple() — A Simple Guide with Video

Python’s built-in tuple() function creates and returns a new tuple object. When used without an argument, it returns an empty tuple. When used with the optional iterable argument, it initializes the new tuple with the elements in the iterable. Read more about tuples in our full tutorial about Python Tuples. Usage Learn by example! Here …

Python tuple() — A Simple Guide with Video Read More »

Python list() — A Simple Guide with Video

Python’s built-in list() function creates and returns a new list object. When used without an argument, it returns an empty list. When used with the optional iterable argument, it initializes the new list with the elements in the iterable. Read more about lists in our full tutorial about Python Lists. Usage Learn by example! Here …

Python list() — A Simple Guide with Video Read More »

How to Get map() to Return a List in Python 3.x

Recap: Python’s map() function takes a function and an iterable—such as a list—as arguments. It then applies the function to each element in the iterable. It returns a map object. 🤨 But what if you don’t need a map object but a list? Old: In Python 2.x this was easy: the map() function simply returned …

How to Get map() to Return a List in Python 3.x Read More »

Python map() — Finally Mastering the Python Map Function [+Video]

The map() function transforms one or more iterables into a new one by applying a “transformator function” to the i-th elements of each iterable. The arguments are the transformator function object and one or more iterables. If you pass n iterables as arguments, the transformator function must be an n-ary function taking n input arguments. …

Python map() — Finally Mastering the Python Map Function [+Video] Read More »

How to Find the Maximum Value in a Python Dict?

There are three problem variants of finding the maximum value in a Python dictionary: Find the maximum value and return this maximum value Find the maximum value and return a (key, value) tuple of both the key and the max value itself Find the maximum value and return only the key assigned to the max …

How to Find the Maximum Value in a Python Dict? Read More »

The Quicksort Algorithm in Python

For a coder, understanding the Quicksort algorithm is like knowing the secret of 42—either you get it, or you don’t belong to the club. If you don’t know either, let’s work on the first one! The Quicksort Algorithm — A Python Implementation The algorithm is a variant of the popular Quicksort algorithm. The function qsort …

The Quicksort Algorithm in Python Read More »

Python enumerate() — A Simple Illustrated Guide with Video

If you’re like me, you want to come to the heart of an issue fast. Here’s the 1-paragraph summary of the enumerate() function—that’s all you need to know to get started using it: Python’s built-in enumerate(iterable) function allows you to loop over all elements in an iterable and their associated counters. Formally, it takes an …

Python enumerate() — A Simple Illustrated Guide with Video Read More »

Python — How to Modify a Sequence While Iterating over It?

Modifying a sequence while iterating over it can cause undesired behavior due to the way the iterator is build. To avoid this problem, a simple solution is to iterate over a copy of the list. For example, you’ll obtain a copy of list_1 by using the slice notation with default values list_1[:]. Because you iterate …

Python — How to Modify a Sequence While Iterating over It? Read More »