Python: Class and Object

An object in Python(and in general OOP) is a collection of data, and the behavior associated with the different aspects of the object. Object-Oriented Programming(OOP) refers to, objects being the primary focus while programming and modeling all real-world entities as objects. So when we analyze a problem, we need to identify 2 things- Class is … Read more

Python: Mathematical Operators

Operator Description + Addition – Subtraction * Multiplication / Division // Floor division ** Power % Reminder Addition Output: Subtraction Output: Multiplication Output: Division Output: Floor Division Output: Reminder Output: Power Output: Precedence of Mathematical Operators Not all operators have the same precedence. Based on the operators’ priority/precedence, the evaluation sequence will change. Let’s check … Read more

Data Structure: Breadth First Search(BFS)

NOTE In this article, we are discussing in detail, the implementation of Breadth First Search(BFS) JavaScript and TypeScript. Check the link below to check the details of Breadth First Search(BST)- Step #1: Node Class Step #2: BfsTree Class Step #3: Insert Method Step #2: bfs Method Full Source Code Demo Output: Testing Time Complexity Operation … Read more

Python: Generator

Generator is a special type of function that produces a series of values over time. That means we can use a generate and get a value, then stop, and later get the next value. This is the process of lazy generation of sequence of values.

Python: package

Python package is a collection of modules in a directory. To tell Python, that this directory should be considered a package, we have to add a file named __init__.py Python package is a directory that contains a __init__.py file and a set of modules. The name of the directory is considered as the name of … Read more

Python: Function

Functions enable us to isolate and encapsulate a certain piece of code into its own block. And then it can be used in different places of the program without repeating the same code over and over again. NOTES In Python, functions are first-class objects(entities), so a function can be- Let’s see how we can define … Read more

Python: if…else [Control Flow]

In the code, we sometimes want certain pieces to be executed, and we ignore certain parts of the code. Keywords like “if“, “else“, and “elif” help us with that. if Condition Using the “if” condition we ask the interpreter to execute the code under the “if” block, only if the provided condition. Check the general … Read more