We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: While

Importance of Constructors while using User Defined Objects with std::vector

For User Defined classes if Copy Constructor and Assignment Operator are public then only one can insert it’s object in std::vector. This is because of two reasons, Advertisements All STL contains always stores the copy of inserted objects not the actual one. So, whenever we insert any element or object in    container then it’s …

Importance of Constructors while using User Defined Objects with std::vectorRead More

c++11 unordered_map : erase elements while iterating in a loop

In this article we will discuss how to erase multiple elements from an unordered_map based on some condition and while iterating. Erasing Multiple elements from unordered_map while iterating Suppose we have an unordered_map of string and integers as key value pairs i.e. Advertisements First : 1 Second : 2 Third : 3 Fourth :  4 Fifth : 5 …

c++11 unordered_map : erase elements while iterating in a loopRead More

C++ Map: Erase by Value or Callback while iterating | erase_if for map

In this article we will discuss two different ways to erase elements from map i.e. In previous article we discussed how to erase elements by key and iterator using member function std::map::erase. But there is no default function to delete elements by value instead of key or delete elements based on callback. Advertisements We will …

C++ Map: Erase by Value or Callback while iterating | erase_if for mapRead More

Java : How to Remove elements from HashMap while Iterating

In this article we will discuss different ways to remove elements from HashMap while Iterating. Let’s create a HashMap of String as Key and Integer as value and add some elements into it i.e. Advertisements // Create a HashMap of string and int HashMap<String, Integer> wordFreqMap = new HashMap<>(); // Add elements in Map wordFreqMap.put(“this”, …

Java : How to Remove elements from HashMap while IteratingRead More

Erase elements from a Set while Iterating in C++ & Generic erase_if()

In this article we will discuss how to erase elements from a set while iterating over it. Erasing elements from std::set while Iterating std::set provides a member function erase() that accepts an iterator as an argument and deletes it from the set i.e. iterator erase (const_iterator position); But it makes the passed iterator invalid. From …

Erase elements from a Set while Iterating in C++ & Generic erase_if()Read More

Python : How to Remove multiple keys from Dictionary while Iterating ?

In this article we will discuss how to remove multiple key / value pairs from dictionary while iterating. Suppose we have a dictionary of string and int i.e. Advertisements # Dictionary of strings wordFreqDic = { “Hello”: 51, “at” : 23 , “test” : 33, “here” : 63, “start” : 13 } Now we want …

Python : How to Remove multiple keys from Dictionary while Iterating ?Read More

Pandas : skip rows while reading csv file to a Dataframe using read_csv() in Python

In this article we will discuss how to skip rows from top , bottom or at specific indicies while reading a csv file and loading contents to a Dataframe. Python panda’s library provides a function to read a csv file and load data to dataframe directly also skip specified lines from csv file i.e. Advertisements …

Pandas : skip rows while reading csv file to a Dataframe using read_csv() in PythonRead More

Python: while loop – Explained with examples

In this article, we will learn the syntax and usage of a while loop in python. Need of a while loop? In python, if we write some statements like this, Advertisements print(‘First line’) print(‘Sample text’) print(‘Last line’) The interpreter will execute these statements in sequential order, but only once from top to bottom. What if …

Python: while loop – Explained with examplesRead More

Python: Remove elements from a list while iterating

This article will discuss different ways to delete elements from a list while iterating over it. Table of Contents Remove elements from list in for loop Remove elements from a list while iterating using list comprehension Remove elements from a list while iterating using filter() function Summary Remove elements from list in for loop Suppose …

Python: Remove elements from a list while iteratingRead More

Cart

Your Cart is Empty

Back To Shop