Pavitra has Published 239 Answers

Python Object Comparison “is” vs “==”

Pavitra

Pavitra

Updated on 23-Dec-2019 06:37:29

In this article, we will learn about object comparision i.e. between < is > operator & equality operator < == > .The equality operator works on the value of the passed argument whereas is operator compares the reference of the two objects passed as arguments.In case of equality operator contents ... Read More

Python Program to print all permutations of a given string

Pavitra

Pavitra

Updated on 20-Dec-2019 07:34:07

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a string we need to display all the possible permutations of the string.Now let’s observe the solution in the implementation below −Example Live Demo# conversion def toString(List):    return ''.join(List) # ... Read More

Python program to find uncommon words from two Strings

Pavitra

Pavitra

Updated on 20-Dec-2019 07:31:43

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given two strings, we need to get the uncommon words from the given strings.Now let’s observe the solution in the implementation below −Example Live Demo# uncommon words def find(A, B):    # ... Read More

Python program to find number of local variables in a function

Pavitra

Pavitra

Updated on 20-Dec-2019 07:29:18

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a function, we need to display the number of local variables in the function.Now let’s observe the solution in the implementation below −Example Live Demo# checking locals def scope():    a ... Read More

Python program to find Cumulative sum of a list

Pavitra

Pavitra

Updated on 20-Dec-2019 07:26:28

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 create a list with the cumulative sum.Now let’s observe the solution in the implementation below −Example Live Demo# cumulative sum def Cumulative(l):    new = []   ... Read More

Python Program to Count trailing zeroes in factorial of a number

Pavitra

Pavitra

Updated on 20-Dec-2019 07:24:23

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an integer n, we need to count the number of trailing zeros in the factorial.Now let’s observe the solution in the implementation below −Example Live Demo# trailing zero def find(n):   ... Read More

Python Program to Count set bits in an integer

Pavitra

Pavitra

Updated on 20-Dec-2019 07:22:44

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an integer n, we need to count the number of 1’s in the binary representation of the numberNow let’s observe the solution in the implementation below −#naive approachExample Live Demo# count ... Read More

Python Program to Count number of binary strings without consecutive 1’

Pavitra

Pavitra

Updated on 20-Dec-2019 07:20:06

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a positive integer N, we need to count all possible distinct binary strings available with length N such that no consecutive 1’s exist in the string.Now let’s observe the solution ... Read More

Python Program to Count Inversions in an array

Pavitra

Pavitra

Updated on 20-Dec-2019 07:17:40

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 count the inversion required and display it.Inversion count is obtained by counting how many steps are needed for the array to be sorted.Now let’s observe ... Read More

Python Program for Triangular Matchstick Number

Pavitra

Pavitra

Updated on 20-Dec-2019 07:15:18

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given a number X which represents the floor of a matchstick pyramid, we need to display the total number of matchstick required to form a pyramid of matchsticks with x floors.Now ... Read More

Previous 1 ... 4 5 6 7 8 9 10 ... 24 Next
Advertisements