
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

570 Views
Let’s say we have a python dictionary which has lists as it values in the key value pairs. We need to create a list which will represent all possible combinations of the keys and values from the given lists.With sorted and productThe product function from itertools can be used to create a crtesian product of the iterable supplied to it as parameter. We sort the dictionary and use two for loops to create the combination of all possible key value pairs from the lists in the dictionary.Example Live Demoimport itertools as it Adict = { "Day": ["Tue", "Wed"], "Time": ... Read More

349 Views
Lists are one of the most extensively used python data structures. In this article we will see how to combine the elements of two lists and produce the final output in a sorted manner.With + and sortedThe + operator can join the elements of two lists into one. Then we apply the sorted function which will sort the elements of the final list created with this combination.Example Live DemolistA = ['Mon', 'Tue', 'Fri'] listB = ['Thu', 'Fri', 'Sat'] # Given lists print("Given list A is : ", listA) print("Given list B is : ", listB) # Add and sort res = ... Read More

593 Views
For data analysis, we sometimes take a combination of data structures available in python. A list can contain tuples as its elements. In this article we will see how we can combine each element of a tuple with another given element and produce a list tuple combination.With for loopIn the below approach we create for loops that will create a pair of elements by taking each element of the tuple and looping through the element in the list.Example Live DemoAlist = [([2, 8, 9], 'Mon'), ([7, 5, 6], 'Wed')] # Given list of tuple print("List of tuples : ", Alist) # ... Read More

333 Views
The sum of two sides of a triangle is always greater than the third side. This is called triangle inequality. Python list of lists we will identify those sublists where the triangle inequality holds good.With for and >We will first get all the sublists sorted. Then for each sublist we will check if the if the sum of first two elements is greater than the third element.Example Live DemoAlist = [[3, 8, 3], [9, 8, 6]] # Sorting sublist of list of list for x in Alist: x.sort() # Check for triangular inequality for e in Alist: if e[0] ... Read More

360 Views
Sometimes in a given Python list we may be interested only in the first digit of each element in the list. In this article we will check if the first digit of all the elements in a list are same or not.With set and mapSet in Python does not allow any duplicate values in it. So we take the first digit of every element and put it in a set. If all the digits are same then the length of the set will be only 1 has no duplicates allowed.Example Live DemoAlist = [63, 652, 611, 60] # Given list print("Given ... Read More

1K+ Views
JSON is a type of text format use to exchange data easily between various computer programs. It has a specific format which Python can validate. In this article we will consider a string and using JSON module we will validate if the string represents a valid JSON format or not.Creating JSON ObjectThe json module has method called loads. It loads a valid json string to create a Json object. In this example we load the string and check that there is no error in loading the JSON object. If there is error we consider the JSON string as invalid.Example Live Demoimport ... Read More

315 Views
In this article, we will find the smallest difference in angles between two parts of a given circle using the C++ programming language. Before proceeding to the code, let’s first understand how we can calculate the angles to find the smallest difference between them. We are given the angles of all the pieces of the circle in the array. We have to join the pieces in such a way that the angle difference between the two pieces is the least. Let's go through the input and output scenario for better understanding. Here, we declare an array contianing three different angles ... Read More

4K+ Views
In this problem, we are given string str. Our task is to create a program to find Smallest and Largest Word in a String in C++.Problem Description − Here, we have a string we need to find the word whose length is maximum and minimum out of all words in the string. The word is separated using white spaces or null(\0) characters.Let’s take an example to understand the problemInputstr = “Learn Programming at TutorialsPoint”Outputsmallest word = at largest word = TutorialspointSolution ApproachTo find the smallest and largest word, we will find the length of each word by using two indexes, ... Read More

2K+ Views
In this article, we will learn how to find the Slope of a line using a program. But before we proceed into the program, let's first understand what the Slope of a line represents in mathematics and how to compute it using its mathematics formula in C++. In mathematics, the Slope of a line is a numerical value that measures the line’s steepness and direction. It indicates the rate at which the line ups or down as you move along it from left to right (or horizontally). Generally, it is denoted by the letter "m". In mathematics, the steepness refers to the slope or gradient of a line. In terms of mathematical, ... Read More

606 Views
In this problem, we are given a doubly linked list. Our task is to create a program to find size of Doubly Linked List in C++.Doubly Linked List is a special type of Linked list in which navigation is possible in both ways, either forward and backward easily as compared to Single Linked List. The following are the important terms to understand the concept of doubly linked lists.Link − Each link of a linked list can store a data called an element.Next − Each link of a linked list contains a link to the next link called Next.Prev − Each ... Read More