How to sort a list in Python without sort function | Example code

You can use Nested for loop with if statement to get the sort a list in Python without sort function. This is not the only way to do it, you can use your own logic to get it done. How to sort a list in Python without sort function example Simple example code will sort Read More…


How to sort Numbers in Python without sort function | Example Code

You can use loops statement with if statement to get sort Numbers in Python without sort function. However, you can do it with your own logic using basic code. How to sort Numbers in Python without sort function examples Simple example code sorts the given list in ascending order using a while loop. Using append Read More…


Lambda Expression Python | Function

Using Lambda Expression you can create an Anonymous Function in Python. Normal Python functions are created by using the def keyword. But when you want to declare a function anonymously use Python Lambda Expression. The expression is executed and the result is returned: Example Lambda Expression Python Lambda functions are anonymous or nameless (a function Read More…


key lambda Python (Key=lambda) function example

Use key when you want to sort the data using the Python lambda function. The key lambda sorted could treat string items as an int to achieve this. This is why the key keyword argument is used. Note: A lambda is an anonymous function: Example Key=lambda Python Simple example code. Suppose given list of items Read More…


Python multiline lambda function | Example code

Can you write Multiline Lambda in Python? No, you can’t write multiline lambda in Python because the lambda functions can have only one expression. The creator of the Python programming language – Guido van Rossum, answered this question in one of his blogs. where he said that it’s theoretically possible, but the solution is not Read More…


Python Anonymous function | Function defined with no names

The function without a name is called the Anonymous function in Python. Normally functions are defined using the def keyword in Python but anonymous functions are defined using the lambda keyword. Syntax It’s also called the lambda function because it is defined with the lambda keyword. Python Anonymous function examples A simple example created a Read More…


Python type function | Get object type

Python type function is used to get the type of object. This function with one argument, return the type of an object. The type() function is mostly developers use it for debugging purposes. Syntax Note: The isinstance() function is recommended for check the type of an object because it takes subclasses into account. Example type Read More…


Python pass function as argument | Example code

Just use the name of the function as a argument for another function. Methods and functions are objects in Python, just like anything else, and we can pass them around the way do variables. Functions (and methods) are first class objects in Python. So you can pass function as an argument into another one in Read More…


Item function in Python | Dictionary method

A items() method is used with a dictionary to get the list with all dictionary keys with values. This method actually returns a view object that contains the key-value pairs of the dictionary, as tuples in a list. Item function syntax:- Example Item function in Python Simple example code. Get all items of a dictionary Read More…


How to use return value in another function Python | Example code

Simply call a function to pass the output into the second function as a parameter will use the return value in another function python. Example pass a function in another function in Python Simple example code, using return value inside another function. Output: How can I use a function output as an input of another Read More…