
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 33676 Articles for Programming

1K+ Views
There may be a situation when we need to convert the elements in the list into a list in itself. In other words, create a list which is nested as its elements are also lists.Using iterationThis is the novel approach in which we take each element of the list and convert it to a format of lists. We use temporary list to achieve this. Finally all these elements which are converted to lists are group together to create the required list of lists.Example Live DemolistA = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] print("Given list:", listA) new_list = [] # Creating ... Read More

340 Views
In this problem, we are given three arrays arr1[], arr2[], and arr3[] all of size N. Our task is to create a program to find the Maximum sum from three arrays such that picking elements consecutively from same is not allowed in C++.Problem DescriptionWe will find the maximum sum by choosing N elements. i=th element can be chosen of the sum from the i-th element of the array i.e. ith sum is from arr1[i]/ arr2[i]/ arr3[i]. Also, keep in mind that we cannot choose two consecutive elements that can be chosen from the same array.Let’s take an example to understand ... Read More

241 Views
We know the arithmetic operations between different arrays happens monthly if the arrays are of equal size awesome required specific size. But there are scenarios when we can take erase of unequal size and still apply arithmetic operations on them by enhancing one of the arrays by filling array with smaller ndim prepended with '1' in its shape. So basically broadcasting and array means changing its shape to any required shape.Rules of array BoradcastingArray with smaller ndim than the other is prepended with '1' in its shape.Size in each dimension of the output shape is maximum of the input sizes ... Read More

157 Views
In this problem, we are given a binary tree consisting of positive numbers. Our task is to create a program to find the Maximum sum from a tree with adjacent levels not allowed in C++.Code DescriptionHere, we will find the maximum sum of node of the tree in such a way that the sum does not contain nodes from two adjacent levels of the tree.Let’s take an example to understand the problem, Output21ExplanationTaking root as starting level, sum = 5 + 3 + 8 + 1 = 17 Taking sub-child of root as starting level, sum = 2 + 6 ... Read More

238 Views
This module provides support for maintaining a list in sorted order without having to sort the list after each insertion of new element. We will focus on two functions namely insort_left and insort_right.insort_leftThis function returns the sorted list after inserting number in the required position, if the element is already present in the list, the element is inserted at the leftmost possible position. This function takes 4 arguments, list which has to be worked with, number to insert, starting position in list to consider, ending position which has to be considered. The default value of the beginning and end position ... Read More

148 Views
When we instantiate a class in Python, all its variables and functions also get inherited to the new instantiated class. But there may be e occasions when we do not want some of the variables of the parent class to be inherited by the child class. In this article, we will explore two ways to do that.Instantiation ExampleIn the below example we show how the variables are instance heated from a given class and how the variables are shared across all the instantiated classes. Live Democlass MyClass: listA= [] # Instantiate Both the classes x = MyClass() y = ... Read More

357 Views
We have a list containing only numbers. We plan to get the average of a set of sequential numbers from the list which keeps rolling from the first number to next number and then to next number and so on.ExampleThe below example simplifies the requirement of finding the average of each 4-length consecutive elements of the list.Given list: [10, 12, 14, 16, 18, 20, 22, 24, 26] Average of every segment of 4 consecutive numbers: [13.0, 15.0, 17.0, 19.0, 21.0, 23.0]With sum and rangeWe use the list comprehension approach to take the sum of the consecutive numbers by ... Read More

1K+ Views
TKinter is a Python module which is used for GUI programming in Python. We create a Canvas and place our UI components with many properties and behaviors in it. In this article, we will see e how to use the ask essay file function to save files created through Python programs into the local drives.We first create a canvas on which we again place a button using the TTK dot button function. Then declare another function that will use the ask fine to define the file type and save the file into location in the local drive.Examplefrom tkinter import * ... Read More

409 Views
Python can help us use excel files directly from the python environment. We can refer to the each cell or a range of cells in excel and apply arithmetic operators on those cells. The results of those operations can also be stored at some cells whose location can be specified by the python program.In the below examples we are performing various arithmetic operations using inbuilt functions of excel. Like sum or average of numbers inside cells. The results are also stored at specific locations. We use the openpyxl module which opens a workbook and marks it active. Then we store ... Read More

182 Views
Suppose we have three integers n, m, and k. If we have following algorithm to find the maximum element of an array of positive integers −max_val := -1 max_ind := -1 search_cost := 0 n := size of arr for initialize i := 0, when i < n, update (increase i by 1), do: if max_val < arr[i], then: max_val := arr[i] max_ind := i (increase search_cost by 1) return max_indWe have to make the array arr which has the following criteria: arr has exactly n integers. all elements arr[i] are in range 1 to m(including) (0