Welcome to the Blog!
Solving Problem: Tax Calculator
(If-elif control flow) Problem Statement: Once upon a time, there was a country inhabited by happy and prosperous people. The people paid taxes, of course – their happiness had limits. The most important tax, called the Personal Income Tax (PIT ), had to be paid yearly and was evaluated using the following rule: Your task is to write…
Solving Problem: Two Sum
(Python) Problem Statement: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output:…
Bit Manipulation Basics
(Python) Let’s have a quick review of Bit Manipulation techniques in Python. Bitwise Operators Operator Description Example & Bitwise AND a & b ` Bitwise OR a ` b ^ Bitwise XOR a ^ b ~ Bitwise NOT ~a << Left Shift a << n >> Right Shift a >> n Example Program Output: a…
Types of AI
Artificial Intelligence (AI) is a trending technology around the world. Let’s understand its types. What is AI? Artificial Intelligence (AI) is the capability of a computational system to pursue human intelligence, like learning, reasoning, perception, problem solving, and decision making. Types of AI Types of AI based on capabilities: Narrow AI (Weak AI): Narrow AI…
Object Oriented Programming – Polymorphism
What is Polymorphism? Polymorphism means “many forms”.In OOP, it allows the same method name (or operator) to behave differently depending on the object or data type it is acting upon. It helps in: Types of Polymorphism in Python Python mainly supports runtime polymorphism (method overriding) and compile-time-like polymorphism (method overloading via default arguments or *args). 1. Polymorphism with Functions and Objects A single function…
Object Oriented Programming – Inheritance
What is Inheritance? Inheritance is a fundamental concept in object-oriented programming (OOP) that allows a class to inherit attributes and methods from another class. This promotes code reusability and establishes a hierarchical relationship between classes. Basic Syntax and Example In Python, inheritance is implemented by defining a new class that derives from an existing class.…
Object Oriented Programming – Abstraction
What is Abstraction? Abstraction is a fundamental concept in Object-Oriented Programming (OOP) that focuses on hiding the internal implementation details of a class or method while exposing only the necessary functionality. This simplifies code interaction, reduces complexity, and enhances maintainability. In Python, abstraction is achieved using abstract classes and abstract methods, which are defined in the abc module. Abstract Classes and Methods…
Object Oriented Programming – Encapsulation
What is Encapsulation? Encapsulation is an Object-Oriented Programming (OOP) concept where data (attributes) and methods (functions) are bundled together in a class and access to the data is controlled to protect it from unintended interference or misuse. Why Encapsulation? Access Modifiers in Python Python does not have strict access modifiers like some other languages, but…
Object Oriented Programming
(OOP) What is Object Oriented Programming (OOP)? Object-Oriented Programming (OOP) is a programming paradigm that organizes software design around objects — entities that combine data (attributes) and behavior (methods). It models real-world entities and promotes modularity, reusability, and maintainability in code. At its core, OOP uses classes as blueprints to create objects. A class defines the structure (attributes) and capabilities (methods) of its objects, while each object is an instance with…
Solving Problem: Balanced Parenthesis
Data Structures – Stacks Problem Statement: You are given a block of code or a string. Check for balanced parenthesis. Example: Sample Input1: Expected Output1: False Sample Input2: Expected Output2: True Solution: Output:
Something went wrong. Please refresh the page and/or try again.
Follow My Blog
Get new content delivered directly to your inbox.
