Python List Sorting

Sometimes we might need to sort lists in Python programming. This article will discuss Python list sorting methods. Using list.sort method Python lists have a built-in sort method it modifies the list in place. The syntax of the list.sort method Parameters key : Callable function that takes a single argument reverse : a boolean value … Read more

How To Get the Type of a Variable in Cpp

Sometimes we need to determine the variable type at runtime in C++ code. This tutorial will discuss how to get the type of a variable in C++. The typeid operator allows us to determine the type of variable/object at runtime. The syntax of typeid operator Parameters: Typeid operator accepts one parameter : Type – Variable … Read more

Categories C++

Cppfront – A new Syntax for CPP

Cppfront feature image

C++ is a good programming language, it is used in performance-critical areas like gaming, multimedia processing, etc but some parts of CPP language syntax are still old-style (cpp1). Cppfront is an experimental compiler for C++ syntax2 (cpp2) by  Herb Sutter. My goal is to explore whether there’s a way we can evolve C++ itself to … Read more

Categories C++

Difference between yield and yield from in Python

The PEP 255 introduced generators in Python. The yield keyword is normally used with generators. This article will discuss the difference between “yield” and “yield from“. The yield statement The generator is a function that returns an iterator. Normally a generator function has a yield statement. To define a generator function we need to use … Read more

Python Reverse A String

In this article, we will discuss reversing a string in Python. We will look into different approaches. 1. Naive method In this naive approach, we will loop through each letter in the string and joins them to form a reverse string as shown below. Output 2. Reverse using list.reverse() In this approach, we will convert … Read more

Law of Demeter

In this article, we will understand the Law of Demeter (LoD), the principle of least knowledge. It is a design guideline to develop software, particularly in the object-oriented (OO) world. Ian Holland introduced this law in 1987 when he was working on the Demeter project. Demeter is the Greek goddess of Agriculture. The LoD got … Read more

Switch Case in Python

A switch case is a flow control statement used in programming languages. In this article, we will discuss the switch case in Python. The syntax of switch statements in programming languages like C++, C, Java, etc. How does it work? The switch expression is evaluated once The value of each case is evaluated, if there … Read more

Python Range Function

Python offers different inbuilt functions, one such function is range. In this tutorial, we will learn about range functions in Python with examples. The range function Rather than being a function, the range type is an immutable sequence of numbers. Ranges implement all of the common sequence operations except concatenation and repetition. Syntax of the … Read more