## Multi-Line printing in Python Pavitra

Updated on 30-Dec-2019 10:26:04

We have usually seen the print command in python printing one line of output. But if we have multiple lines to print, then in this approach multiple print commands need to be written. This can be avoided by using another technique involving the three single quotes as seen below.Example Live Demoprint(''' ... Read More

## Contingency Table in Python Pavitra

Updated on 30-Dec-2019 10:22:38

A contingency table is a table showing the distribution of one variable in rows and another variable in columns. It is used to study the correlation between the two variables. It is a multiway table which describes a dataset in which each observation belongs to one category for each of ... Read More

## Adding two Python lists elements Pavitra

Updated on 30-Dec-2019 10:14:57

Lists can be added in python resulting in creation of a new list containing elements from both the lists. There are various approaches to add two lists and they are described below. But in all these cases the lists must be of same length.Using Append()Using append() we can add the ... Read More

## Python-program-to-convert-pos-to-sop Pavitra

Updated on 24-Dec-2019 05:55:35

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given pos form we need to convert it into its equivalent sop formThe conversion can be done by first counting the number of alphabets in the pos form and then calculating all ... Read More

## Python program to print all Prime numbers in an Interval Pavitra

Updated on 24-Dec-2019 05:46:13

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an interval we need to compute all the prime numbers in a given rangeHere we will be discussing a brute-force approach to get the solution i.e. the basic definition of a ... Read More

## Python program to insert an element into sorted list Pavitra

Updated on 24-Dec-2019 05:30:25

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a list, we need to insert an element in a list without changing sorted orderThere are two approaches as discussed below−Approach 1: The brute-force methodExample Live Demodef insert(list_, n):    # search ... Read More

## Python program to get all subsets of a given size of a set Pavitra

Updated on 24-Dec-2019 05:26:57

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a set, we need to list all the subsets of size nWe have three approaches to solve the problem −Using itertools.combinations() methodExample Live Demo# itertools module import itertools def findsubsets(s, n):   ... Read More

## Python program to get all subsets of given size of a set Pavitra

Updated on 24-Dec-2019 05:21:19

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given two integers, we need to display the common divisors of two numbersHere we are computing the minimum of the two numbers we take as input. A loop to calculate the divisors ... Read More

## Python Program to find whether a no is power of two Pavitra

Updated on 24-Dec-2019 05:18:26

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a number, we need to check that the number is a power of two or not.We can solve this using two approaches as discussed below.Approach 1: Taking the log of the ... Read More

## Find the transpose of a matrix in Python Program Pavitra

Updated on 24-Dec-2019 05:15:29

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a matrix, we need to display transpose of the matrix.Transpose of a matrix is obtained by replacing the value present at A[i][j] by A[j][i].Now let’s observe the concept in the implementation ... Read More