Pavitra has Published 145 Articles

Python Program for Sieve of Eratosthenes

Pavitra

Pavitra

Updated on 20-Dec-2019 06:51:15

2K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a number n, we need to print all primes smaller than or equal to n. Constraint: n is a small number.Now let’s observe the solution in the implementation below −Exampledef ... Read More

Python Program for Recursive Insertion Sort

Pavitra

Pavitra

Updated on 20-Dec-2019 06:48:55

1K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement− We are given an array, we need to sort it using the concept of recursive insertion sort.Insertion sort works on creating a parallel array in which we manually insert the elements in the specified ... Read More

Python Program for QuickSort

Pavitra

Pavitra

Updated on 20-Dec-2019 06:46:04

6K+ Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an array, we need to sort it using the concept of quicksortHere we first partition the array and sort the separate partition to get the sorted array.Now let’s observe the solution ... Read More

Python Program for array rotation

Pavitra

Pavitra

Updated on 20-Dec-2019 05:23:17

188 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − Given a text and a pattern, we need to print all occurrences of pattern and its permutations (or anagrams) in text.Now let’s observe the solution in the implementation below −Example Live Demo# maximum value ... Read More

Unit Testing in Python Program using Unittest

Pavitra

Pavitra

Updated on 27-Sep-2019 11:30:13

182 Views

In this article, we will learn about the fundamentals of software testing by the help of unittest module available in Python 3.x. Or earlier. It allows automation, sharing of the setup and exit code for tests, and independent tests for every framework.In unit test, we use a wide variety of ... Read More

Python Program to Print Numbers in an Interval

Pavitra

Pavitra

Updated on 27-Sep-2019 11:06:50

510 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven the starting and ending range of an interval. We need to print all the numbers in the interval given.A prime number is a natural number greater than 1 that has no positive ... Read More

Python program to print all odd numbers in a range

Pavitra

Pavitra

Updated on 27-Sep-2019 08:05:27

946 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven a range, we need to print all the odd numbers in the given range.The brute-force approach is discussed below −Here we apply a range-based for loop which provides all the integers available ... Read More

Python program to print all even numbers in a range

Pavitra

Pavitra

Updated on 27-Sep-2019 08:01:48

2K+ Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven a range, we need to print all the even numbers in the given range.The brute-force approach is discussed below −Here we apply a range-based for loop which provides all the integers available ... Read More

Python Program to find whether a no is the power of two

Pavitra

Pavitra

Updated on 27-Sep-2019 07:56:11

245 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven a number n, we need to check whether the given number is a power of two.ApproachContinue dividing the input number by two, i.e, = n/2 iteratively.We will check In each iteration, if ... Read More

Python program to find the most occurring character and its count

Pavitra

Pavitra

Updated on 26-Sep-2019 14:31:24

474 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statementGiven an input string we need to find the most occurring character and its count.ApproachCreate a dictionary using Counter method having strings as keys and their frequencies as values.Find the maximum occurrence of ... Read More

Previous 1 ... 4 5 6 7 8 ... 15 Next
Advertisements