Simplicity is Python’s way to solve a problem.

  1. Reverse a string, list or tuple →

Whenever I’d find myself in a situation where I was required to perform a reverse operation, more often than not, I would use a for loop or resort to find some function like reverse() that…

Kill the messier code with functools elegancy


Partial is a higher order function which allows the partial application of a function. Suppose there is a function with lots of arguments but you need to change only one or two argument every time you use that function, Partial function comes to the rescue. Using Partial function, you can…

In Python, functions are first class citizens. But what does this mean?

The first class objects are program entity which have these five characteristics:

1. Can be created at runtime.
2. Can be assigned to a variable.
3. Can be passed as a argument to a function.
4. Can be…

Embrace the power of sorted function in Python

As a programmer we all know what sorting is, so I will not write theory here and will go directly into code.

Python has inbuilt function sorted which can be use to sort any iterable. sorted function return the new sorted iterable unlike list.sort function which perform inplace sorting.


How to make your object play well with built-in operators

Each operator can be used in different way for different types of operands. for example when + is used with integers, it add integers to give result and when + is used with string, it concatenates the provided strings.

x, y = 10, 20
print(x + y) # 30

Take advantage of the heapq module to implement a Priority Queue

What is a Priority Queue?

A Priority Queue is a type of queue in which every element is associated with priority and it returns the element of highest priority on every pop operation.
if priority is same the elements are return on basis of their insertion order.

We can easily implement priority queue in Python…

Make your code more functional.

Object oriented programming makes code understandable by encapsulating moving parts. Functional programming makes code understandable by minimizing moving parts. — Michael Feathers

map, filter and reduce are essentially just some of the most well-known, easy to use, higher-order functions that run provided callback on each…

Understand the different usage of function in JavaScript

In other object oriented programming languages Function, Method and Constructor call may be different things but in JavaScript these are just different usage pattern of one programming construct — Function.


function sayHello(){
return 'Hello World!';
console.log(sayHello()); // logs: Hello World!

Improve your code using higher order functions.

Higher order functions may sound some complicated technical term but it is nothing but a normal function which take function as arguments or return a function as their result. …

Step by step guide to understand closures.

Many developers find closures intimidating who come from language which does not support them. But there is nothing to be afraid from closures and the effort you put to understand closures will pay you many times over.

To understand the closures you need…

Aditya Dhanraj Tiwari

Amor fati, Find my small house for thoughts @

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store