Varun

Convert Long to String in C++ | (3 ways)

In this article, we will learn about three different ways to convert a long to a string in C++ i.e. Using to_string() function Using stingstream Using Boost’s lexical_cast() function. Let’s discuss them one by one. Convert long to string using to_string() C++ provides a function std::to_string() for converting values of different types to string type. …

Convert Long to String in C++ | (3 ways) Read More »

Python | Add dictionary to dictionary without overwriting

In this article, we will discuss how to add the contents of a dictionary to another dictionary without overwriting values of similar keys. Suppose we have two dictionaries with some similar keys. Like this, dict_1 and dict_2 have following common keys – ‘test’, ‘at’, ‘Hello’. Now we want to add the contents of a dictionary …

Python | Add dictionary to dictionary without overwriting Read More »

Add key-value pairs to an empty dictionary in Python

This article will discuss different ways to add key-value pairs to an empty dictionary in python, like using [] operator, update() function or dictionary comprehension. Add key-value pairs to an empty dictionary using [] operator Suppose we have an empty dictionary like this, To add a new key-value pair, we can pass the key in …

Add key-value pairs to an empty dictionary in Python Read More »

Scroll to Top