Python Unknown (Tips and Tricks) — Part 2

Python features, tips, and tricks which are less — known.

HarshAditya_Gaur
2 min readFeb 3, 2022
Python Unknown

In continuation of the previous section, here are some more techniques to apply in daily coding practices for faster problem solving and to take maximum advantage of the Python language.

Note — All features are tried and tested on python v3.8 (Anaconda3)

Python frozenset() function - This function provides the ability to turn a mutable set into an immutable set.

Python lambda function — A lambda function can have an indefinite number of arguments, but only in one expression (one-line code). This type of function doesn’t have any name associated with them.

Python filter() function - This function filters a sequence using a function that checks if each element in the sequence is true or not.

Syntax : filter(function, iterable)

Note : Lambda functions can be integrated with filter function.

Python reduce() function - This function reduces a index of items into a single value by applying the function to each item in the index, using a mathematical approach called folding / reduction.

Syntax : reduce(function, iterable)

Note : Lambda functions can be integrated with reduce function too.

If - Elif operation - This block of code can exist without the else block at the end of the loop, but elif can sustain without if.

More such tips and trick for python v3, coming soon in part 3..!!

Thank You..!! :)

--

--